Pregunta

How can I filter through multiple Backbone.js collections? Something like this:

var a = _.filter([b.models, c.models], function(model){
    return model.get('d');
});

Thanks!

¿Fue útil?

Solución

You can make this work by combining the two models with _.union

var combinedCollection = _.union(b.models, c.models);
var a = _.filter(combinedCollection, function(model){
    return model.get('d');
});
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top