Cannot use ion-nav.getByIndex() in ionic-angular

Cannot use ion-nav.getByIndex() in ionic-angular v4.

constructor(public navCtrl: NavController){}

    console.log( this.navCtrl.getByIndex() );

I get this message in the Console:

**ERROR in src/app/editevent/,42): error TS2339: Property 'getByIndex' does not exist on type 'NavController'.**

Can you actually use this in Angular? The docs are not clear at all.

To use ion-nav.getByIndex() , you need to use the ion-nav component (), but not the navController.

   const nav = document.querySelector('ion-nav') 
      	for(let i=0;i<100;i++) {    
           let v: any = await nav.getByIndex(i)     
           if (!v) // no more view

Unfortunately, the method getLength() is not public yet which is why Iā€™m checking the validity of the first 100th views! : cf. pull request

1 Like