This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat($compile): add support for $observer 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 #5609
- Loading branch information