Posted On: Feb 22, 2018
In order to access a models data from a view in backbone.js you have to initialize your Model :
var author= Backbone.Model.extend({ initialize: function(){ console.log('intailized'); }, defaults:{ names:['Bob','Sim','Dart'] } }) var person_view = Backbone.View.extend({ initialize: function() { this.model = new author(); }, output: function(){ console.log(this.model.get('names')) } });
Never Miss an Articles from us.
Backbone.js is a client-side (Model, View, Controller) MVC-based JavaScript framework.It purely is written in Javascrip..
Backbone’s Js only hard dependency is Underscore.js ( >= 1.8.3). For RESTful persistence and DOM manipulation with..
The Backbone.js router is used to change the URL fragment or hashes of an application to create bookmarkable and shareab..