我有仪表板链接列出工作状态 当我搜索几个单词时它的工作正常,但是当我粘贴完整的工作名称/输入完整的工作名称时,我没有得到结果。
这是我的代码:
html代码:
tr ng-repeat="x in person | filter : search |pagination: curPage *
pageSize | limitTo: pageSize"
Angular js代码:
var app = angular.module('myApp', [ 'ngResource','ui.bootstrap' ]);
app.filter('pagination', function () {
return function (input, start) {
if (input) {
start = +start;
return input.slice(start);
}
return [];
};
});
function MyController($scope, $http) {
$scope.search = "search";
$scope.curPage = 1;
$scope.pageSize = 10; // items per page
$scope.getDataFromServer = function() {
$http({
method : 'GET',
url : 'PopulateTable'
}).success(function(data, status, headers, config) {
$scope.person = data;
$scope.numberOfPages = function()
{
return Math.ceil($scope.person.length / $scope.pageSize);
};
}).error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
$scope.resetFilters = function () {
// needs to be a function or it won't trigger a $watch
$scope.search = {};
};
// pagination controls
$scope.totalItems = $scope.person.length;
// $watch search to update pagination
$scope.$watch('search', function (newVal, oldVal) {
$scope.filtered = filterFilter(1000, newVal);
$scope.totalItems = $scope.filtered.length;
$scope.noOfPages = Math.ceil($scope.totalItems / $scope.entryLimit);
$scope.curPage = 1;
}, true);
};
// create empty search model (object) to trigger $watch on update
};
任何人都可以帮助我。 TIA