How to pass parameters in pop method of ionic2

后端 未结 8 1601
隐瞒了意图╮
隐瞒了意图╮ 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:32

    For sent data with pop you can use getPrevious() method.

    When leaving from current page get previous page and send data

    ionViewWillLeave() {
        this.navCtrl.getPrevious().data.formData = {credentials: {...}};
    }
    

    In next page get data from navParams

    ionViewWillEnter() {
        if (this.navParams.get('formData')) {
          // do something
        }
      }
    

提交回复
热议问题