【发布时间】:2014-01-26 10:35:23
【问题描述】:
在我的 Controller 中注入 $debounce 时,我遇到了这个错误:Unknown provider: $debounceProvider
myControllers.controller('Controller',
['$scope', '$compile', '$rootScope', '$timeout', '$document', '$debounce','promiseTracker',
function ($scope, $compile, $rootScope, $timeout, $document,$debounce, promiseTracker) {
$scope.$watch('newquery', function (newValue, oldValue) {
if (newValue === oldValue) { return; }
$debounce(applyQuery, 350);
});
var applyQuery = function () {
$scope.filter.query = $scope.query;
};
}]);
【问题讨论】:
-
没有注册 $debounce 服务。你认为它一定来自哪里?哪个模块定义了服务?
-
它可能包含在 angular 1.3 中:github.com/angular/angular.js/issues/2690
标签: angularjs debouncing