Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic2: Send params between pages (When clicking on the return nav button) using navParam

Does anyone know how returns a simple value (or JSON) by clicking on the nav return button on ionic2? I know that navParam is able to send a value on push, but I didn't find anything about the pop action and connect the return nav button to my new pop action.

like image 812
Kevin Didelot Avatar asked Mar 12 '23 20:03

Kevin Didelot


1 Answers

There is a open feature request about back navigation with parameters.

One solution is to pass a Promise through NavParams:

Parent

new Promise((resolve, reject) => {
  this.nav.push(ChildPage, {resolve: resolve});
}).then(data => {
  // process data
});

Child

this.navParams.get('resolve')('some data');
like image 154
muetzerich Avatar answered Apr 26 '23 06:04

muetzerich