In my app..
While i load the page or refresh the page my router not properly responding and calling the default view method. in case if i use other link to vist other hash url... works as well the back button doing fine.
Even while i load my page, my initiate function as well works fine. but the default method not triggering while i load the page and use the back button of the browser.
what cause this.. here is my code:
define([
"backbone",
"../model/model",
"../collection/collection",
"../views/appView",
"../views/listView",
"../views/appViews"],
function(Backbone,appModel,collection,appView,listView,appViews){
var appRouter = Backbone.Router.extend({
routes:{
"":"defaultView",
"list":"listAItem",
"add":"listViewIt"
},
initialize:function(){
console.log("initiated....."); //works properly
},
defaultView:function(){
new appViews(); // not working..
},
listAItem:function(){
console.log("from listAItem");
// on click and using back button woks fine
},
listViewIt:function(){
new listView();
// on click and using back button woks fine
}
});
Backbone.history.start(); // removed and updated to where i call my app...
return appRouter;
})
Now i updated my Backbone.history to call after initiating my app.. now my initial method (defual view called) but still while i use my back / font buttons in my browser not working.. but reset are works fine..
how to fix it..
here is my updated code:
$.when.apply(null,requests).done(function(){
var app = new router();
//on refresh works, but not working while use back / front button of browser use.
Backbone.history.start();
});