I have a view with the following initialize
method:
initialize: function(){
this.model.on("all", this.render)
},
And in the render method I access the model's content using:
var contents = this.model.attributes.content;
The content
property of the model is an array.
So when I add something to the array using model.set()
through the console, the render method is called, but I get the following error :Uncaught TypeError: Cannot read property 'attributes' of undefined(…)
.
But after adding if I call view.render()
manually, it renders the model nicely.
Again if I add anything, it throws the same error.
Solutions?