我在变量中有以下数据:
[{"age":"65","_id":"526fb6c940301e040e000002","name":{"first":"Jane","last":"Does"},"__v":0,"modified":"2013-10-31T10:03:26.435Z"},{"age":"25","_id":"526fb6c940301e040e000001","name":{"first":"John","last":"Doe"},"__v":0,"modified":"2013-10-31T10:03:26.436Z"},{"age":"45","_id":"526fb6c940301e040e000003","name":{"first":"Alice","last":"Smith"},"__v":0,"modified":"2013-10-31T10:03:26.436Z"}]
我正在尝试用这些数据引导我的收藏。
this.collections.staff = new StaffCollection;
this.collections.staff.reset( data , {parse: true} );
当我console.log(this.collection.staff)
时,结果如下:
我做错了什么?
感谢
答案 0 :(得分:0)
答案 1 :(得分:0)
也许您可以尝试以下方法:
var json_data = JSON.parse( '{{data variable in String}}' );
this.collections.staff = new StaffCollection( json_data, {parse:true} );