Slide 41
Slide 41 text
Use Collection
var Note = Backbone.Model.extend({
defaults: {
title: '',
content: ''
},
urlRoot: '/note'
});
var Notes = Backbone.Collection.extend({
model: Note
});
var notes = new Notes([
{ id: 1, title: 'note 1', content: 'This is note 1.' },
{ id: 3, title: 'note 3', content: 'This is note 3.' },
{ id: 5, title: 'note 5', content: 'This is note 5.' },
{ id: 6, title: 'note 6', content: 'This is note 6.' },
{ id: 9, title: 'note 9', content: 'This is note 9.' }
]);
define model first