Ionic 2 + Deeplink: navigate only after platform is ready


#1

I added some Deeplinks to my Ionic 2 app, something like:

links: [
    { component: About, name: About, segment: 'about' },
    { component: Birthdays, name: Birthdays, segment: 'birthdays' }
]

if i point in the url /#/about, the app loads with the About component. It’s perfect.
The thing is that I needed to the app load this links defines in the Deeplinks after the platform.ready()'s event fire. My app needs to check some values defined in NativeStorage before it continues, and as long NativeStorage is async, the main component (with the platform.ready()) isloaded, then the About, before the NativeStorage check I do ends.

Is it possible?


#2

I know this is really late but I had a similar issue and this is how I made it work.

ngAfterViewInit() {
this.service.getUser().then(user => {
this.nav.setRoot(this.nav._linker.segments[0].name)