Sarath
Sarath

Reputation: 1499

Ionic 2 Web application Routing

I am new in ionic 2 development. I am using ionic 2 to build an application for web and mobile devices. I have one concern in web development using ionic 2.

I'm using ionic 2 navigation for switching from one component to another (push method). This method will not construct a URL for the web application. Once we refresh the page it will go to the route page.

My Questions are:

  1. Is it possible to construct a url using ionic 2 navigation functions?

  2. Is it possible to manage page refresh in my web application using ionic 2 navigation?

  3. Will angular 2 routing work for an ionic application with both web and mobile?

I am really stuck on these questions. please help !!!!

Upvotes: 4

Views: 1025

Answers (2)

Mohan Gopi
Mohan Gopi

Reputation: 7724

for your first question

1) yes you can do url using ionic 2 navigation functions using deep link by just seeing the below blogs will let you know how easy it is in ionic 3 http://blog.ionic.io/ionic-and-lazy-loading-pt-1/

2). check this http://blog.ionic.io/ionic-and-lazy-loading-pt-2/ provided by ionic team it is clearly explained how to do it

3) i don't think so in coding wise but both activity looks same but may be in future they will implement it so far ionic is using their own navigation.

Upvotes: 0

bennyxguo
bennyxguo

Reputation: 845

Depend on which version of Ionic are you currently using.

  1. For ionic 2.x.x the default push navigation will not generate urls, but you could add the plugin Deeplinks to enable urls for each page.

http://ionicframework.com/docs/native/deeplinks/

  1. if you are using ionic version 3.x.x by default using Lazyloading will result in having urls for each page. The urls by default is auto generated and it also can be customized and also you can put get variables in the url.

check out the official documents here http://ionicframework.com/docs/api/navigation/IonicPage/

Side note: You could still add the Deeplinks plugin to Ionic version 3.x.x for advance features.

Now answers to your questions accordingly:

  1. Yes, check out my above two solutions to this.
  2. I really don't see a point of refreshing any of you pages, since angular2 support data binding, you could change any of your data on your ts side and the data will change on your view end. So you do not need to refresh the page at all.
  3. The deeplinks plugin is actually base on angular2's routing so for this questions I would say yes.

Upvotes: 2

Related Questions