时间: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);