Navigating using URLs

I’m working on an Angular 2 project which in the first place will be deployed as an web app but later will be deployed as an Hybrid app as well. Obviously Ionic will be the ideal tool for this, and the first beta release looks very promising!

In the Ionic documentation (http://ionicframework.com/docs/v2/getting-started/navigating/) I read the following:

Note: When it comes to URLs, Ionic 2 works a bit differently than Ionic 1. Instead of using URLs to navigate, you use them to make sure you can always come back to a page (on app launch, for example). You can navigate to pages from anywhere, which wasn’t possible in v1. For example, you can show the same Playlist page instead of a tab, a side menu, or a modal. This means you don’t use href to navigate around.

Using URLs to navigate to a specific page is required and for Google to index certain pages some form of URL routing (like the RouteConfig of Angular 2) must be available.

Is there any example on how to accomplish this?

1 Like

Please see my response here:

Hi @brandyshea can you please give an example to pass parameters with query string.

also can you please give some advice that how I remove route parameters from url ?

I mean if I declare a route like
{ path: '/3/:id', component: View3Cmp, as: 'Third' }

and I have a

<ion-navbar *navbar>
  <ion-title>Category List</ion-title>
</ion-navbar>

to return category list page .the url segments use for route still present browsers address bar.I want to remove them .

How do I do this?

Hi @brandyshea, thanks for the example, works like a charm.
It is possible for me to access a page directly using the URL, but navigating to another page is a bit problematic;

I’m using Ionics NavController to be able to have more control over the stacks (in some cases I want a page to be the new rootPage – when using ng2s Router it will never be a rootPage) the page sometimes opens up twice.
I suspect the Angular router to play a part in that; Ionic creates a new Page and probably the Router picks up the new URL and also creates the Page that matches the URL.

update
This problem is solved with the latest beta