Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. // call to $watch will return a de-register function
  2. var listener = $scope.$watch(someVariableToWatch, function(....));
  3.  
  4. $scope.$on('$destroy', function() {
  5. listener(); // call the de-register function on scope destroy
  6. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement