54
rated 0 times
[
60]
[
6]
/ answers: 1 / hits: 16797
/ 11 Years ago, sat, june 8, 2013, 12:00:00
I'm trying to use backbone.js model.set property. The second alert function should fire off after todo1.set is being implemented. However it is not.
Here is the jsfiddle link: http://jsfiddle.net/SGEkn/
var Todo = Backbone.Model.extend({
defaults: {
title: Harsh,
completed: false
},
initialize: function() {
console.log('This model has been initialized.')
}
});
var todo2 = new Todo({
title: 'Set through instantiation.',
completed: true
});
console.log('Todo title: ' + todo2.get('title'));
console.log('Todo completed ' + todo2.get('completed'));
alert(ok);
todo2.set(title, 'Title set');
alert(ok);
console.log(todo2.get('title'));
todo.set(completed, false);
console.log('completed: ' + todo2.get('completed'));
More From » jquery