0

这就是我加载数据的方式

// 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 | filter:search  | limitTo:pageSize" class="odd">

这是我设定起点的事情

<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
4

1 回答 1

0

原来我controller.js

var Home = angular.module("Home", []);

此外

app.js

var Home = angular.module("Home", []);

controller.js擦除了我们的客户过滤器

于 2013-08-27T02:08:38.710 回答