I get this uncaught type error of object is not a function when trying to write a collection view. I have used the same code while doing the App but as am re doing the app with require.js, I get this error. Please help me. Here is the code :
define([
'underscore',
'backbone',
// Sub Views
'view/todo_view'
],function(
_,
Backbone,
// Sub Views
TodoView
){
return Backbone.View.extend({
el:$('#todos'),
render: function(){
this.collection.forEach(this.addOne,this);
return this;
},
addOne: function(todoIt1){
var todoView = new TodoView({
model: todoIt1
});
this.$el.append(todoView.render().el);
}
});
});