Saved Bookmarks
| 1. |
How can you reset a $timeout and disable a $watch()? |
|
Answer» In order to reset $TIMEOUT, we call the .CANCEL() method on it. as shown below: var myTimer = $timeout(FUNCTION() { /* your code */ }, 1000);$timeout.cancel(myTimer);To disable $watch, we can just call it as shown below: var deregisterWatch = $scope.$watch(function() { /* Your code */ });deregisterWatch(); // CALLING the WATCHER disables it. |
|