How to pass parameters in pop method of ionic2

后端 未结 8 1599
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 07:04

I tried passing parameters in push method of ionic2. like this

this.nav.push(SecondPage, {
    thing1: data1,
    thing2: data2
});

but is ther

8条回答
  •  难免孤独
    2021-02-04 07:45

    This is how I achieved it in ionic-3 and find it easier.

    Page from where we pop()

     this.navCtrl.getPrevious().data.thing1 =data1;
     this.navCtrl.getPrevious().data.thing2 =data2;
     this.navCtrl.pop();
    

    Page after pop():

    public ionViewWillEnter() {
         this.thing1 = this.navParams.get('thing1')|| null;
         this.thing2 = this.navParams.get('thing2')|| null;
    } 
    

提交回复
热议问题