Routing --> resolve equivalent in Ionic2



Below is the example scenario, if we logging in to training site to see registered user details, if the number of users registered is only one then it has to be directed from login screen to user details page. If there are more than one user than page to should be redirected to user list page.

In ionic 1 we achieved by using angular 1’s resolve during routing. ionic 2 uses its own routing , so how do I achieve this is in ionic 2.

Thanks & Regards,


there is this:

and you can try to achieve this using the ionicView Hooks -->

There are navigation guards… like ionViewCanLeave, ionViewCanEnter where you can return a promise, if you are able to enter a specific route.

Take a look over the guards, maybe you can build something up with them.

But think about if you implement two different behaviours … I would show the list first, even if there is only one user.


When we use NavController lifecycle events, there is small glitch while rendering, users, will see first page for a millisecond and then second page gets rendered.

Thanks & Regards,


and if you determine where you need to redirect before navigating?


  1. login
  2. Show Loading layer while login requests is processing
  3. After Login request succeeded --> get the number of users
  4. Now hide loading layer and redirect to correct page?

You could store the user(s) information in a service, so you do need to resend this request again :wink:


Above approach is good but only concern is I will be using a different service in login component apart from login service.

One last question (hope so :slight_smile:) Can we use angular 2’s routing in ionic2 instead of ionic’s navController?