I have a model called person:
var person = Backbone.Model.extend({ initialize: function(){ console.log('cool'); }, defaults:{ names:['a','k','d','s','h','t'] } })
Now I have a view:
var person_view = Backbone.View.extend({ model : person, output: function(){ console.log(this.model.get('names')) } });
Created a view object:
var obj = new person_view()
Try accessing the names:
obj.output()
But I got this error:
TypeError: Object function (){ parent.apply(this, arguments); } has no method 'get'
Can you show me what to do? I just started getting acquainted with backbone.js, so please bear with me.
Wern ancheta
source share