I want to pass some data between the pages in ionic version 5. Is there any possible way to do this? I am using ionic version '5.4.16' and angular version '10.0.8'.
See Question&Answers more detail:osI want to pass some data between the pages in ionic version 5. Is there any possible way to do this? I am using ionic version '5.4.16' and angular version '10.0.8'.
See Question&Answers more detail:osPage 1
constructor(public nav: NavController){}
pushToNextScreenWithParams(pageUrl: any, params: any) {
this.nav.navigateForward(pageUrl, { state: params });
}
Page 2
constructor(public router: Router){
if (router.getCurrentNavigation().extras.state) {
const pageName = this.router.getCurrentNavigation().extras.state;
console.log(pageName)
}
}