使用分页时,AngularJS筛选会导致循环依赖项错误
这就是我加载数据的方式使用分页时,AngularJS筛选会导致循环依赖项错误,angularjs,coldfusion,pagination,circular-dependency,Angularjs,Coldfusion,Pagination,Circular Dependency,这就是我加载数据的方式 // Loads entire list of Metriclibs. function HomeCtrl($scope, $http, $location) { $scope.data = []; $scope.pageSize = 100; $scope.currentPage = 0; $scope.lastPage = 0; // This is async $http.get('index.cfm/json/metricli
// Loads entire list of Metriclibs.
function HomeCtrl($scope, $http, $location) {
$scope.data = [];
$scope.pageSize = 100;
$scope.currentPage = 0;
$scope.lastPage = 0;
// This is async
$http.get('index.cfm/json/metriclib')
.success(function(data) {
$scope.data = data;
$scope.lastPage = Math.floor($scope.data.length/$scope.pageSize);
})
.error(function(data) {
console.log("Data load error");
})
;
$scope.go = function ( path ) {
$location.path( path );
};
$scope.numberOfPages=function(){
return $scope.lastPage;
}
}
这就是我在不分页的情况下显示数据的方式(这是可行的)
这是我设定的起点
<tr ng-repeat="datum in data | startFrom:0 | limitTo:pageSize" class="odd">
当我做第二个时,我得到:
[19:58:24.355] "Error: Circular dependency:
getService@http://xxxxxxxx/toolbox_hacking/assets/angular.js:2855
@http://xxxxxxxx/toolbox_hacking/assets/angular.js:9604
filter@http://xxxxxxxx/toolbox_hacking/assets/angular.js:6157
_filterChain@http://xxxxxxxx/toolbox_hacking/assets/angular.js:6148
statements@http://xxxxxxxx/toolbox_hacking/assets/angular.js:6124
parser@http://xxxxxxxx/toolbox_hacking/assets/angular.js:6057
@http://xxxxxxxx/toolbox_hacking/assets/angular.js:6623
Scope.prototype.$eval@http://xxxxxxxx/toolbox_hacking/assets/angular.js:8057
ngRepeatWatch@http://xxxxxxxx/toolbox_hacking/assets/angular.js:13658
Scope.prototype.$digest@http://xxxxxxxx/toolbox_hacking/assets/angular.js:7935
Scope.prototype.$apply@http://xxxxxxxx/toolbox_hacking/assets/angular.js:8143
done@http://xxxxxxxx/toolbox_hacking/assets/angular.js:9170
completeRequest@http://xxxxxxxx/toolbox_hacking/assets/angular.js:9333
createHttpBackend/</xhr.onreadystatechange@http://xxxxxxxx/toolbox_hacking/assets/angular.js:9304
[19:58:24.355]“错误:循环依赖项:
getService@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:2855
@http://xxxxxxxx/toolbox_hacking/assets/angular.js:9604
filter@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:6157
_filterChain@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:6148
statements@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:6124
parser@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:6057
@http://xxxxxxxx/toolbox_hacking/assets/angular.js:6623
范围.原型$eval@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:8057
ngRepeatWatch@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:13658
范围.原型$digest@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:7935
范围.原型$apply@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:8143
done@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:9170
completeRequest@http://xxxxxxxx/toolbox\u hacking/assets/angular.js:9333
createHttpBackend/结果是我的controller.js
有
var Home = angular.module("Home", []);
除了
app.js
var Home = angular.module("Home", []);
controller.js
删除了我们的“我的客户”过滤器你在缩小你的代码吗?没有。我有未缩小的1.07
var Home = angular.module("Home", []);