2013-10-15 21 views
3

是否有一種簡單的方法可以將模型插入到一個集合的某個位置並將所有模型(包括指定索引處的模型)移回原位,這樣基本上可以將模型「滑入」某個位置的集合?有相應的方法,例如.slice()骨幹插入位置和移位模型

myCollection.add(myModel, {at: 14});

另外的提問的第二部分:

回答

2

插入到集合中的指定索引處可以與所述方法.add()來執行與通過選項{at: index}

我打賭你可以在documentation找到最合適的一個。

1

來源:the docs

Pass {at: index} to splice the model into the collection at the specified index.