I have a couple of input fields, we can use an input field with the name of search as an example. when someone types into that field i want to be able to filter the results of an object. but i want to do the filter server side not client side. i have a database with a lot of records so i don't want to have to return them all and do the filtering client side, it really slows things down. id also like to implement pagination with angular js. any pointers? or a direction i should head?
I use mongodb as a db store
Here is the example using mongolab: http://jsfiddle.net/CLVpf/2/
You can just $watch the query variable to construct query URL,
and call query() against 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 the ngResource instance.