This.nav.insert(0, Page); with rc3

Hi All,

I have just upgraded from Ionic 2 beta to Ionic 2 rc3. I was using the following code, which doesn’t seem to navigate to the new page (MyPage) in the rc3 version.

import { NavController } from 'ionic-angular';

    constructor(public nav: NavController...
        this.nav = nav;
        ...

        this.nav.insert(0, MyPage);

Any ideas appreciated.

Don’t know if one of them will help you:

this.nav.push(MyPage); 

=> navigate to page MyPage and add it in the stack aka back possible

this.nav.setRoot(MyPage);

=> navigate to page MyPage and define it as root of current nav aka if you do that for example from a tab application, the page gonna be added as root of current tab not root of the overall app aka no back possible in that navigation

this.app.getRootNav().setRoot(MyPage); 

=> navigate to page MyPage and set as overall root page. Useful for example in case of a Logout. Overall no back possible.

Furthermore, for each of these methods, you could pass params as second parameters, like this.nav…(MyPage, {funkyParam1: ‘yo’, funkyParam2: ‘fresh’});

Hope this helps?

1 Like