AngularJS 监听变量变化的实现方法
时间:2022-01-06 09:20:48|栏目:AngularJS|点击: 次
如下所示:
var timeout;
$scope.$watch('search.subj',function (newVal, oldVal) {
if (newVal !== oldVal) {
if (timeout) $timeout.cancel(timeout);
timeout = $timeout(function() {
$scope.doSearch();
}, 800);
}
}, true);
栏 目:AngularJS
本文地址:http://www.codeinn.net/misctech/189337.html






