13. Learn backbone.js tutorial from scratch for beginners(Part 16) Model Inheritance in backbone.js

C:\Users\Administrator\Desktop\gulp\app.js
jQuery(document).ready(function($) {
var FirstModel = Backbone.Model.extend({
initialize: function() {
},
Playing: function() {
console.log("Inheritance Model");
}
});
fmodel2 = FirstModel.extend({});
fmodel3 = new fmodel2();
var ModelView = Backbone.View.extend({
model: fmodel3,
initialize: function() {
this.render();
},
render: function() {
fmodel3.Playing()
}
});
vmodel = new ModelView();
});

C:\Users\Administrator\Desktop\gulp\app.js
jQuery(document).ready(function($) {
var FirstModel = Backbone.Model.extend({
initialize: function() {
},
Playing: function() {
console.log("Parent Inheritance Model");
}
});
fmodel2 = FirstModel.extend({
Playing: function() {
console.log("Child Inheritance Model");
}
});
fmodel3 = new fmodel2();
var ModelView = Backbone.View.extend({
model: fmodel3,
initialize: function() {
this.render();
},
render: function() {
fmodel3.Playing()
}
});
vmodel = new ModelView();
});
Previous12. Learn backbone.js tutorial from scratch for beginners(Part 15) More Model Events and listenTo evNext14. Learn backbone.js tutorial from scratch for beginners(Part 17) Collection in backbone js
Last updated
Was this helpful?