How to use ng 2 router in to a "tutorial" template side menu app?


#1

I am looking to migrate an ionic 1 app to 2 and one of the core requirements I have is to make sure this app is web friendly - meaning works on mobile web (with url paths) and desktop browser and so forth.

Is there a good reference sample making use of ng 2 router and still being able to leverage the new ionic 2 navigation (push/pop)?

Looked at the ionic-conference-app on github but it doesn’t specifically address a clean replacement for my requirement of having url/path based routing.

Does the ionic 2 navigation framework provide a simple way to inject address bar urls and paths?


#2

Okay I did this get the urls to show up in the address bar. But now the navigation is interfering with it and causing view to load twice and just seems wrong.

@RouteConfig([
{ path: ‘/login’, component: LoginPage, name: ‘Login’, useAsDefault: true },
// { path: ‘/main’, component: MainPage, name: ‘Main’ },
{ path: ‘/docs’, component: DocsPage, name: ‘Docs’ },
{ path: ‘/chat’, component: ChatPage, name: ‘Chat’ }
])

Seems like ionic 2 is less desktop webapp friendly than ionic 1, or am I missing something…


#3

A good example is to checkout the preview app for our component demos.

We use the router in that to persist the urls.

Though be warned, the router is under-going some big changes in new releases for angular 2. I wouldn’t try to use it too much until a bit later.