Skip to content

Instantly share code, notes, and snippets.

@guisouza
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guisouza/0194ea5926e6316f08d8 to your computer and use it in GitHub Desktop.
Save guisouza/0194ea5926e6316f08d8 to your computer and use it in GitHub Desktop.
app.filter('filtro', function() {
return function( items, campo, valor) {
var filtered = [];
angular.forEach(items, function(item) {
if(item[campo] === valor) {
filtered.push(item);
}
});
if (filtered.length){
return filtered;
}
return {err:'não deu =D '}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment