I have a directive that includes a <select> element that is bound to a
model property.
app.directive('myDropDown', )
return{
template:
'<select ng-model="itemsPerPage" ng-options="item.text for item in
pagemodel.labels.itemsperpage"></select>'
};
NOTE: there is no isolated scope on the directive.
The parent controller looks something like this:
app.controller('pageController', function ($scope) {
$scope.itemsPerPage = { value: 10, text: "" };
$scope.DoSomeStuff = function(){
//the stuff to do
};
$scope.$watch('itemsPerPage', function () {
$scope.DoSomeStuff();
}, true);
};
My expectation was that when the select list in the directive changed it
would set the itemsPerPage property in the main controller which would be
"caught" by the $watch-er ad then execute the function which would operate
on the updated object in the itemsPerPage property. However, the $watch is
not getting executed. Why is the $watch handler not getting triggered.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.