Hard refresh to last routable tab


#1

I am trying to save the last route in my localstorage so that if a user hits a refresh button in their browser they would end up back on the tab they were last on. everything in here seems to work, except router.navigate refuses to do anything. am i not able to use router.navigate in the init block?

in my app.js:

 on: {
	init: function () {
		  		
		var lastRoute = localStorage.getItem("lastRoute");
		
		if(lastRoute && lastRoute != '/'){
				
			this.router.navigate(lastRoute, {
				reloadAll: true,
				ignoreCache: true,
			});
			
		}		
		
						
	},
	tabShow: function (tab) {
		
		localStorage.setItem("lastRoute",app.views.main.router.url);
		
    }
  }, // end of on handler global params

#2

router привязан к view должен быть: view.router.navigate(…);


#3

I get: Uncaught ReferenceError: view is not defined if i try that.


#4

Покажите кусок кода, который создает view


#5

var homeView = app.views.create(’#view-home’, {
url: ‘/’
});


#7

Ну тогда: homeView.router.navigate(url);