我的AngularJS应用程序中有一个watch函数.
$scope.$watch('quartzCrystal', function () {
...
}
然而,在某种情况下(在我的例子中,在我single-page application岁时更改页面),我想停止该手表(就像清除超时).
我该怎么做?
我的AngularJS应用程序中有一个watch函数.
$scope.$watch('quartzCrystal', function () {
...
}
然而,在某种情况下(在我的例子中,在我single-page application岁时更改页面),我想停止该手表(就像清除超时).
我该怎么做?
$watch
返回一个注销函数.打电话给它会取消$watcher
的注册.
var listener = $scope.$watch("quartz", function () {});
// ...
listener(); // Would clear the watch