jQuery(document).ready(function($) {
var FirstModel = Backbone.Model.extend({
initialize: function() {
}
});
fmodel = new FirstModel();
fmodel.set({
name: "<p>Tuong</p>",
author: "Lionel Pham"
});
var ModelView = Backbone.View.extend({
model: fmodel,
initialize: function() {
this.render();
},
render: function() {
console.log(this.model.escape("name"));
console.log(this.model.get("name"));
console.log(this.model.toJSON());
}
});
vmodel = new ModelView();
});
jQuery(document).ready(function($) {
var FirstModel = Backbone.Model.extend({
initialize: function() {
}
});
fmodel = new FirstModel();
fmodel.set({
name: "<p>Tuong</p>",
author: "Lionel Pham"
});
var ModelView = Backbone.View.extend({
model: fmodel,
initialize: function() {
this.render();
},
render: function() {
if(this.model.has("name")) {
console.log("Has key");
}else {
console.log("Has't key");
}
this.model.unset("name");
console.log(this.model.toJSON());
}
});
vmodel = new ModelView();
});
jQuery(document).ready(function($) {
var FirstModel = Backbone.Model.extend({
initialize: function() {
}
});
fmodel = new FirstModel();
fmodel.set({
name: "<p>Tuong</p>",
author: "Lionel Pham"
});
var ModelView = Backbone.View.extend({
model: fmodel,
initialize: function() {
this.render();
},
render: function() {
if(this.model.has("name")) {
console.log("Has key");
}else {
console.log("Has't key");
}
// this.model.unset("name");
this.model.clear("name");
console.log(this.model.toJSON());
}
});
vmodel = new ModelView();
});
jQuery(document).ready(function($) {
var FirstModel = Backbone.Model.extend({
defaults: {
name: 'first',
author: 'Default Author',
},
initialize: function() {
}
});
fmodel = new FirstModel({
});
fmodel.set({
name: "<p>Tuong</p>"
});
var ModelView = Backbone.View.extend({
model: fmodel,
initialize: function() {
this.render();
},
render: function() {
console.log(this.model.toJSON());
}
});
vmodel = new ModelView();
});