Skip to content

Instantly share code, notes, and snippets.

@robwormald
Created February 5, 2014 15:32
Show Gist options
  • Save robwormald/8826141 to your computer and use it in GitHub Desktop.
Save robwormald/8826141 to your computer and use it in GitHub Desktop.
blas.queryAndGroup = function (permissions) {
var deferred = $q.defer()
// load accounts from backend and group by owner
var foobar = $resource(
'/api/accounts', {
}, {
query: {
method: 'GET',
isArray: true,
cache: true
}
}
}
);
foobar.query().then(function(datas){
//filter your data in here
var filtered = $filter('filtername')(arg1,arg2);
then resolve the promise w/ the filterd data
return deferred.resolve(filtered)
})
//return your own promise
return deferred;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment