爲什麼該變量在此Backbone示例中未定義?主幹每個未定義
var Action = Backbone.Model.extend({
defaults: {
"selected": false,
"name": "First Action",
"targetDate": "10-04-2014"
}
});
var Actions = Backbone.Collection.extend({
model: Action
});
var actionCollection = new Actions([new Action(), new Action(), new Action(), new Action()]);
_.each(actionCollection, function(item) {
alert(item);
});
的jsfiddle這裏:http://jsfiddle.net/netroworx/KLYL9/