|
@@ -10,7 +10,10 @@ const TodoItem = Backbone.Model.extend({
|
|
|
// Default parse() implementation, not needed with RoR style APIs
|
|
|
// parse: response => response,
|
|
|
|
|
|
- parse: (response) => response.todo,
|
|
|
+ // Long format for arrow function to allow breakpoint setting in Chrome.
|
|
|
+ parse: (response) => {
|
|
|
+ return response.todo;
|
|
|
+ },
|
|
|
|
|
|
toggleStatus(view) {
|
|
|
this.set('status', (this.get('status') === 'incomplete')
|
|
@@ -28,7 +31,7 @@ function todoModelSingleExample() {
|
|
|
};
|
|
|
|
|
|
// Create a model instance to load it by ID.
|
|
|
- const todoItem = new TodoItem({ id: 1 });
|
|
|
+ const todoItem = new TodoItem({todo: { id: 1 }}, { parse: true });
|
|
|
|
|
|
// Listeners
|
|
|
todoItem.on('change', onChange);
|