在pop/dismiss中发送params

Dan*_*ani 1 ionic-framework ionic3

我有3条路线.当我从第一个移动到第二个时,我需要传递一个参数: this.navCtrl.push(ReadyPage, { newGame: true });

但是当我从第3个移动到第2个时,我也需要通过这个参数.

我正在尝试这个但不起作用: this.viewCtrl.dismiss({ newGame: true });

比较这两种方法dismiss似乎并没有这样的选择(除非它被称为data代替params): abstract push(page: Page | string, params?: any, opts?: NavOptions, done?: TransitionDoneFn): Promise<any>; dismiss(data?: any, role?: string, navOptions?: NavOptions): Promise<any>;

Dan*_*ani 12

最后一页:

 this.navCtrl.getPrevious().data.newGame = true;
 this.navCtrl.pop();
Run Code Online (Sandbox Code Playgroud)

第2页:

ionViewWillEnter() {
     this.newGame = this.navParams.get('newGame')|| null;
}
Run Code Online (Sandbox Code Playgroud)