Hi to everyone,
i’m trying to send a parameter from a first component to a second component in this way (only relevant code of first component, if i try this.navCtrl.setRoot
etc i get the same effect):
this.navCtrl.push(SecondComponent,{infodata: "val" });
In my second component (only relevant code):
datarec;
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.datarec=this.navParams.get('infodata');
console.log(this.datarec);
}
in my console i can see:
val
undefined
So this code is called two times and the problem is that i can’t use my parameter because it’s always undefined. My questions:
Why it’s called two times? What can make reload the page of the second component?
thanks who will try to help.