3 ms·
Actually ng-change is very much same as a $watch.. Here is the relevant source from Angular.. var ngChangeDirective = valueFn({ require: 'ngModel', l
by ganarajpr 14y ago
Actually ng-change is very much same as a $watch.. Here is the relevant source from Angular..
var ngChangeDirective = valueFn({
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
ctrl.$viewChangeListeners.push(function() {
scope.$eval(attr.ngChange);
});
}
});
- GhotiFish 14y agoWhile you're there, check out line 1033. Where it describes the behavior of $viewChangeListeners It triggers on the $setViewValue event. Not on detecting a model change event, like $watch. They are not the same.