ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

router outlet pop promise executed after then

Open amanitequeen opened this issue 6 years ago • 9 comments

Bug Report

Ionic version: [x] 4.x

Current behavior: When I call pop() promise on a ion router outlet, and I attach a callback to it, the callback is executed before end of pop.

Expected behavior: The callback should be executed after pop

Steps to reproduce: Ionic 4 project,

Related code: app.component.ts

@ViewChild('masterNav', { read: IonRouterOutlet })masterNav: IonRouterOutlet;
@ViewChild('detailNav', { read: IonRouterOutlet })detailNav: IonRouterOutlet;
...
myFunction(): void{
    this.masterNav.pop().then(() => {
       //this hasn't finish to pop, so it goes to the below route... and then pops it
        this.navCtrl.navigateRoot(["", { outlets: { detailNav: "path/to/thing"}}]);
    });
}

app.component.html

<ion-split-pane when="md">
    <ion-router-outlet swipeBackEnabled="false" contentId="detailNav" id="masterNav" #masterNav></ion-router-outlet>
      
    <ion-router-outlet main name="detailNav" id="detailNav" #detailNav></ion-router-outlet>
</ion-split-pane>

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.10.3 (C:\Users\myuser\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.1
   @angular-devkit/build-angular : 0.12.3
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.2.3
   @ionic/angular-toolkit        : 1.2.3

Cordova:

   cordova (Cordova CLI) : not installed
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   Android SDK Tools : 26.1.1 (C:\Users\myuser\AppData\Local\Android\sdk)
   NodeJS            : v10.15.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.7.0
   OS                : Windows 10

amanitequeen avatar Mar 06 '19 11:03 amanitequeen