[V2]Pass context from one route to another

How can i pass the context object from one route to another?

myApp.router.navigate(
	'/page1/',
	{
		context: myContextObjPage1
	}
);

In my route for ‘page1’ i want to do some things in js code and then perform a second navigate and send the original page1 context along to it.

function pageOneStuff() {
	myApp.router.navigate(
		'/page2/',
		{
			context: myContextObjPage1
		}
	);
}

So after digging around in the code i did happen to find where the context data is held. I can then pass that along to the next route. Im not sure if this is the correct or only way to do this but its working for me so far.

page.$el[0].f7Component will hold the context data passed in from .navigate()

Actually this inside of component events and page events has this context. Don’t refer to page.$el[0].f7Component

1 Like