Hi I want to ask, so I have a problem, I want to pass value to the next page but it won’t work. In my scenario I have two page to the same destination (for example: first scenario : A → C, and the second scenario : A → B → C), for first scenario it can pass value and apply it to C page, but for the second scenario the value is already passed but it won’t apply to the variable on page C. I think routing code from source and destination is same. Here is the code… and debug screenshot on second scenario
Page A → page C
gotoPerpanjanganStnk() {
this.router.navigate([‘perpanjangan-stnk’], {
state: {
flag: 0,
agreement: this.agreements
}
});
}
Page B → Page C
gotoPerpanjanganStnk() {
this.popoverCtrl.dismiss();
this.router.navigate(['perpanjangan-stnk'], {
state: {
flag: 1,
agreement: this.agreement
}
});
}
In page C
constructor(private router: Router, private activatedRoute: ActivatedRoute,
private questionService: QuestionService, private agreementService: AgreementApiService) {
this.waiting = false;
this.activatedRoute.queryParams.subscribe(() => {
const extras = this.router.getCurrentNavigation().extras.state;
if (!extras) {
return;
}
this.flag = extras.flag;
this.agreements = extras.agreement;
this.questionsAgreement = this.questionService.getAgreementForm(this.agreements, 0);
// this.questionsAssetInfo = this.questionService.getAssetInfoForm(SharedVariables.agreement);
});
}