Backbone Navigation Error
Whenever I press the back button in my browser the view is empty, and I
get an error like this:
I don't really know what part of my application I should put on here to
help the problem but none of the errors refer to a part of my code..
Interestingly if I press the front button and press the back button again
everything renders perfectly and the error is not there anymore.
My router looks like this:
var AppRouter = Backbone.Router.extend({
initialize: function(){
this.model = new model();
this.collection = new collection();
},
routes: {
"" : "showForm",
"post/:id" : "showPost"
},
showPost: function(id){
var that = this;
this.collection.fetch().complete(function(){
var curmodel = that.collection.get(id);
var post = new postView({model:curmodel});
post.render();
$(".maincontainer").html(post.el);
});
},
showForm : function(){
var that = this;
var qcView = new qcV({collection:this.collection});
qcView.render();
$(".maincontainer").html(qcView.el);
}
});
No comments:
Post a Comment