[ionic 2][Help]load screen using url and angular 2 Location

hello everyone,
Please help me about url routing.
I use DeepLinker https://ionicframework.com/docs/v2/api/navigation/DeepLinker/ and successfully implemented it.
When I browse the url, for example: localhost/my-screen , it loads the screen successfully. However, when I use the angular 2’s Location class to load that url:
location.go('localhost/my-screen');,
the screen doesn’t move, nothing happen, only the address bar on browser changes.

I want to load the whole screen, just like when I browse that url with browser, but apparently I cant do it with angular2’s Location class. anyone know how ? please help me.

Thank you.

You need to use the NavController to navigate to another page.

hi mirkonasato,
yes I know how to use the NavCtrl push/pop. but I want something like this:
NavCtrl.push('localhost/my-screen');
I want to use url as the param for navigation, not the Component class.
I think this feature should be available, because when I use Chrome browser to browse'localhost/my-screen', the browser show the correct screen that I “DeepLink” with. So there’re no reason that I can’t use code (Javascript) to browse to the link correctly.
As I said above, I tried the Angular 2’s Location class to navigate, but failed. I think there’s another way to achieve this.

I don’t think that’s possible, based on the DeepLinker docs.

Unlike traditional web apps, URLs don’t dictate navigation in Ionic apps.

1 Like