8. Learn backbone.js tutorial from scratch for beginners(Part 11) Head back to underscore.js symbol

C:\Users\Administrator\Desktop\gulp\app.js
jQuery(document).ready(function($) {
var FirstModel = Backbone.Model.extend({
initialize: function() {
console.log('Hello, i am here');
}
});
fmodel = new FirstModel();
fmodel.set({
name: "Tuong",
author: "Lionel Pham"
});
var ModelView = Backbone.View.extend({
template: _.template($('#ourTemplate').html()),
el: '#div1',
model: fmodel,
initialize: function() {
this.render();
},
render: function() {
this.$el.html(this.template(this.model.toJSON()));
}
});
vmodel = new ModelView();
});C:\Users\Administrator\Desktop\gulp\index.html
Previous7. Learn backbone.js tutorial from scratch for beginners(Part 10) Model data to underscore.js templNext9. Learn backbone.js tutorial from scratch for beginners(Part 12) Model Events in backbone.js
Last updated
Was this helpful?