在Backbone集合中设置数据:
var someList = ['a', 'b', 'c'];
collection.reset({models:someList});
有没有办法使用model
执行此操作而无需在每个属性上调用set()
?
示例
var pop_star = {
first_name: "Stacey",
last_name: "Ferguson"
}
// There is no "reset()" function on a model, but is there something like it?
model.reset(pop_star);
谢谢!