Posted By

alexedy on 03/21/13


Tagged

filter collection Backbone


Versions (?)

Filter a collection in Backbone


 / Published in: JavaScript
 

Find an object in a collection with underscore. Using the filter function from underscore.

  1. initialize : function() {
  2. this.folders = new FolderCollection();
  3. },
  4.  
  5. analize : function(event){
  6. var selected = _.filter(this.folders, function(num) {
  7. return num.attributes.name == event;
  8. });
  9. console.log(selected);
  10. },
  11.  
  12. .....

Report this snippet  

You need to login to post a comment.