nAkhmedov
nAkhmedov

Reputation: 3592

how to add collection to another collection in Backbone

i`ve an object collection. The problem is that add the object collection to another collection in Backbone.Push and add methods of Bacbone.Collection don't work.here is my collection which is need to be added to another collection

it is object collection

Upvotes: 6

Views: 4166

Answers (1)

Alex Curtis
Alex Curtis

Reputation: 5767

Assuming they are backbone collections (which they don't look like in your console window)

try: collectionA.add(collectionB.models)

If you are trying to add an object array to a collection try this:

_.each(kids.result, function(kid){ collectionA.add(new Backbone.Model(kid)); });

Upvotes: 11

Related Questions