Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Attributes): added support for attributes observing deregistration
In order to make the behavior compatible with $rootScope.$watch and $rootScope.$on methods, and make it possible to deregister an attribute observer, Attributes.$observe method now returns a deregistration function instead of the observer itself. BREAKING CHANGE: calling attr.$observe no longer returns the observer function, but a deregistration function instead. To migrate the code follow the example below: Before: directive('directiveName', function() { return { link: function(scope, elm, attr) { var observer = attr.$observe('someAttr', function(value) { console.log(value); }); } }; }); After: directive('directiveName', function() { return { link: function(scope, elm, attr) { var observer = function(value) { console.log(value); }; attr.$observe('someAttr', observer); } }; }); Closes angular#5609
- Loading branch information