0
Я создал директиву, и я пытаюсь получить доступ к родительской области. Выбранный элемент SelectedItemChange не запускается, и я не могу получить доступ к значению Test1.Доступ к родительскому объекту из директивы
app.directive('driverNotes', function ($location) {
return {
restrict: 'E',
transclude: true,
templateUrl: "../HtmlTemplates/notesTempl.html",
controller: function ($scope, $http) {
console.log($scope.$parent.Test1);
$scope.SelectedItemChange = function(item) {
if (item != undefined || item != null) {
console.log(1);
}
}
}
}
});
шаблон Директива
<md-input-container class="notesTable" flex-gt-sm ng-disabled="userForm.$invalid" ">
<table class="notesTable">
<tr><th>Description</th><th>Date</th><th>Down</th><th>Premium</th><th>Date Updated</th></tr>
<tr ng-repeat="note in notesSearch">
</tr>
</table>
</md-input-container>
Вы должны пройти 'test1' значение директивы через свойство директивы области видимости. Как выглядит шаблон директивы? – Dario
Спасибо, я добавил шаблон директивы выше – user6934713
где '$ scope.SelectedItemChange' в шаблоне директивы? –