Skip to content

Instantly share code, notes, and snippets.

@teeaich
Created August 13, 2013 15:25
Show Gist options
  • Select an option

  • Save teeaich/6222319 to your computer and use it in GitHub Desktop.

Select an option

Save teeaich/6222319 to your computer and use it in GitHub Desktop.
unwatch an expression in angular
var watcher = $scope.$watch('data.counter', function(newValue, oldValue) {
iElement.css('width', 50 * newValue + 'px');
if (newValue >= 10) {
// autodestruction when data.counter reaches 10
watcher();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment