Backbone - Merge 2 Collections together?

后端 未结 6 1814
灰色年华
灰色年华 2020-12-23 23:17

Suppose there are 2 Collections, representing respectively /api/page/1 and /api/page/2; is there anyway (through Underscore, for example) to merge

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-23 23:23

    try this, collection is array of models

    collection1.add(collection2.models); 
    

    if we use

     collection1.add(collection2.toJSON());
    

    then reference chage

提交回复
热议问题