1.

What Is Collection In Backbone.js?

Answer»

Backbone collections are simply an ordered set of models.

Typically, your collection will only USE ONE type of model but models themselves are not limited to a type of collection.

VAR Song = Backbone.Model.extend({
initialize: function(){
console.log("MUSIC is the answer");
}
});

var ALBUM = Backbone.Collection.extend({
model: Song
});

Backbone collections are simply an ordered set of models.

Typically, your collection will only use one type of model but models themselves are not limited to a type of collection.

var Song = Backbone.Model.extend({
initialize: function(){
console.log("Music is the answer");
}
});

var Album = Backbone.Collection.extend({
model: Song
});



Discussion

No Comment Found