Skip to content

Instantly share code, notes, and snippets.

@perrygovier
Created October 22, 2014 20:57
Show Gist options
  • Save perrygovier/a944dd5be9ddefddc9df to your computer and use it in GitHub Desktop.
Save perrygovier/a944dd5be9ddefddc9df to your computer and use it in GitHub Desktop.
angular.module('todoApp', [])...
.controller....
.filter('searchFilter', function() {
return function(input, searchText) {
if(typeof searchText === 'undefined' || searchText == '')return input;
var output = [];
for(var i=0;i<input.length;i++){
if(input[i].text.indexOf(searchText) > -1){
output.push(input[i]);
}
}
return output;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment