Redirection on init is not working?

Below redirection is not working and getting app is undefined error

{
		path: '/',
		url: './index.html',
		name: 'home',
		on: {
			pageBeforeIn: function (event, page) {
				console.log('beforein');
			},
			pageAfterIn: function (event, page) {
				console.log('Afterin');
				// do something after page gets into the view
			},
			pageInit: function (event, page) {
				// do something when page initialized
				var self = this;	               
				//var app = self.$app;
				self.app.router.navigate('/xyz/');
			},
			pageBeforeRemove: function (event, page) {
				console.log('before remove');
				// do something before page gets removed from DOM
			},
		}

	}

It is not a component but rather page event, check page data object docs http://framework7.io/docs/page.html#page-data

it will should be

var app = page.app

Thanks for your quick reply. However is not working.

    {
		path: '/',
		url: './index.html',
		name: 'home',
		on: {
			pageBeforeIn: function (event, page) {
				console.log('beforein');
			},
			pageAfterIn: function (event, page) {
				console.log('Afterin');
				// do something after page gets into the view
			},
			pageInit: function (event, page) {
				// do something when page initialized
				//console.log(page);
				console.log('init 123');
				var app = page.app
				app.router.navigate('/newsfeed/');
				console.log('am herer');
			},
			pageBeforeRemove: function (event, page) {
				console.log('before remove');
				// do something before page gets removed from DOM
			},
		}

	}

Ok, just realized that you are doing redirect. Redirect will not work within page init. What is the point to load the page and redirect to another one immediately. Use async routes for that or route redirects

Thanks for your quick reply. before showing dashboard i need to check user has logged in or not. 

so am using empty index.html with left side navigation once index.html loaded on init am checking user have logged in session or not, based on that am redirecting to login or dashboard page. For this scenario i need redirection on index init method.

For this scenario use async route http://framework7.io/docs/routes.html#async-route

Could you please explain much more details, i have used asyn on index however this method is not calling for index route alone. Please provide how i can handle router for this scenarios.\

1 with out login redirect to login page

  1. with login redirect to dashboard page.

http://framework7.io/docs/view.html#initial-page-route

thanks. Here i need to use asyn method for session checking right?

i tired no luck. could you please share any working sample for this scenario its helps for more people because every site they might follow this logic..

Please show what you have tried

Learnt async from downloading a template and seeing how it was used… It is way too powerfuol than you can actually imagine… With a template example, what you read in the docs makes more sense…