Angular js server side filter and pagination

I have a couple of input fields, we can use the input field with the search name as an example. when someone enters this field, I want to be able to filter the results of the object. but I want the filter server side not to be the client side. I have a database with a large number of records, so I do not want to return them all and perform filtering on the client side, it really slows down. id also wanted to implement pagination using angular js. any pointers? or the direction in which I should head?

I use mongodb as db storage

+4
source share
1 answer

Here is an example using mongolab: http://jsfiddle.net/CLVpf/2/

You can simply $watch request a variable to build the request URL, and call query() on the ngResource instance.

 $scope.$watch('search', function (key) { var q = null; if (key) { q = { q: '{name:{$regex:"' + key + '"}}' }; } $scope.projects = Project.query(q); }); 

Here, Project is an instance of ngResource.

+5
source

All Articles