I am creating a collection that has an external url something like this:
var todoCollection = Backbone.Collection.extend({
model: Todo
url: function() {
return "http:externalurl.com";
},
parse: function(dat) {
return dat.obj.data;
}
});
return new todosCollection;
and my model looks like this:
var TodoModel = Backbone.Model.extend({
initialize: function() {}
});
return TodoModel;
Now here in my view I use the collection in this way:
$.each(this.collection.models,function(i,model){
console.log(model);
})
The problem is, my models are not getting set as the TodoModel type. They are simple Object types. Can someone help me in letting me know where I am going wrong here?
Thank you.