Assume I have a such json setting:
{
page:1,
items:[
{
name: 'item1',
id:1
},
{
name: 'item1',
id:2
},
{
name: 'item1',
id:3
}
]
}
And a such modelling:
var Item = Backbone.Model.extend({
defaults: {name: "No name"}
});
var ItemCollection = Backbone.Collection.extend({
model: Item,
url: '/some/ajax/url',
});
After fetching this json, how can I map the items set as the collection of the ItemCollection and add the page number as an attribute to the collection?