AngularJS - Why watcher is removed? -
i new angularjs , follow long tutorial started. in 1 tutorial shows how remove watcher example below:
$scope.breakit = $scope.$watch('mydata.val',function(newval){ $scope.mydata.toolong = newval.length >3; }) <button ng-click="breakit()">break it</button>
it works, don't understand why calling breakit
function remove watcher?
$scope.$watch
returns function deregisters watcher when called.
Comments
Post a Comment