Need some help to pass Data from one Tab to another ionic3


#1

Hello,

I hope I am in the right forum.

I want to transfer data from one tab to the other.
For this I have created a form in the first tab, the entered data the form should be transfered by clicking on a button to the second Tab.
Unfortunately, that does not work.

First concept:
In the first Tab.ts I have the following method for the button click:

private openSecondTab(name, age, gender){
let dataValues = {name, age, gender};
this.navCtrl.parent.select(1, {dataValues});
}

In the constructor of the second I want to get the passed Data

constructor(public navCtrl: NavController, public navParams: NavParams) {
this.data = this.navParams.get(‘dataValues’);
}

Second concept:
This whole concept works with the push Method in the button
(this.navCtrl.push(SecondTabPage, {dataValues}); but this overrides my first tab with a layer of the second tab.

So does anybody how I can pass the data with my first concept?


#2

Look at using an Angular Provider to get/set this data you need to pass around.


#3

Hello ChrisGriiffith,

thanks for the reply. Could you give me a example, which represents your idea?

Thanks.