Reputation: 21817
I have custom angularjs directive and click
handler in it like:
element.bind('click', function () {
scope.checked = !scope.checked;
});
And i want to catch when scope.checked
is changing, i'm trying to so with:
scope.$watch(scope.checked, function(val){
console.log(val);
});
But i don't see anything.
Thank you.
Upvotes: 0
Views: 665
Reputation: 943
Just a typo; it's:
scope.$watch('checked', function(val){
console.log(val);
});
Reference: http://code.angularjs.org/1.2.16/docs/api/ng/type/$rootScope.Scope#$watch
Upvotes: 1