javascript - how to use match function in angularJS to filter out an object with certain string value -


i'm trying filter out object filename value of "foo"

here have far

          var main_item = [];           var child_item = [];           angular.foreach(item.files, function(value, key){                          if(value.indicator === true && value.filename.match("foo")) {               main_item.push(value);             } else {               child_item.push(value);             }            }); 

so if item.files.indicator true , item.filename matches "foo" push main_item array

item.files.filter(function(file) {return file.filename == "foo"})

might looking for


Comments