My Pagination Code:
http://plnkr.co/edit/WmC6zjD5srtYHKopLm7m
This is a brief overview of my code:
var app = angular.module('hCms', []);
app.controller('samplecontoller', function ($scope, $http) {
$scope.showData = function(){
$scope.method = 'GET';
$scope.url = 'homes.json';
$scope.code = null;
$scope.response = null;
$scope.curPage = 0;
$scope.pageSize = 3;
$http({method: $scope.method,url: $scope.url}).
success(function(data, status) {
$scope.status = status;
$scope.datalists = data;
}).
error(function(data, status) {
$scope.datalists = data || "Request failed";
$scope.status = status;
});
$scope.numberOfPages = function() {
return Math.ceil($scope.datalists.length / $scope.pageSize);
};
}
});
angular.module('hCms').filter('pagination', function()
{
return function(input, start)
{
start = +start;
return input.slice(start);
};
});
The code is functioning well.
However, when I search for "Dis" in the search field, which is on page 3, it doesn't return any results. I believe I need to implement the search functionality on $scope.datalist
within the controller, rather than as a filter.
Could someone guide me in the right direction or provide some insight on this issue?
Thank you,
H.