How I can implement routing with Ionic 2?


#1

I have a situation that I want to develop mobile WEB application using Ionic 2 Beta,I want to make it SEO friendly.

How I can allow routing like:

…/mobile categories
…/mobile categories/category1
…/mobile categories/category1/:mobileId1
…/mobile categories/category1/:mobileId1/:brand1

So as an user if I hit url in above format it should redirect to respective page in application. if this feature is not yet supported in Beta then when do you expect that will be available ?


#2

I’m trying to figure out the same thing. Angular 2 Routing is actually quite awesome and the Ionic 2 Preview App on Github has a demonstration of Routing (and all of the components in the docs - a great resource) but it doesn’t cover the case of URLs with parameters as you mention. The Angular 2 routing docs cover how to do it but the nav.setRoot() and nav.push() methods don’t seem to update the route when passed in with parameters.


#3

Actually, I just realized that nav.setRoot() and nav.push() do, in fact, work with parameters passed in. For example if a route is configured as

{path: '/category1/:mobileId1/:brand1', component: Catergory1Page }

and you wanted to navigate to it you would do

nav.setRoot(Category1Page, { mobileId1: 'xx', brand1: 'yy' }

where ‘xx’ and ‘yy’ are the parameter value


#4

on which file you put {path: '/category1/:mobileId1/:brand1', component: Catergory1Page } ?