문제

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!

도움이 되었습니까?

해결책

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');
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top