I am using ionic 4. It does not accept to receive data using navparams. Here is my sender page method:
//private route:Router
gotoFinalView(intent) {
ionic 4 navigation with params
sender page 1. import the following
import {NavController} from '@ionic/angular';
import { NavigationExtras } from '@angular/router';
gotonextPage()
gotonextPage()
{
let navigationExtras: NavigationExtras = {
state: {
user: 'name',
parms:Params
}
};
this.navCtrl.navigateForward('pageurl',navigationExtras);
}
4.Receiver Page
import { ActivatedRoute, Router } from '@angular/router';
constructor( private route: ActivatedRoute, private router: Router)
{
this.route.queryParams.subscribe(params => {
if (this.router.getCurrentNavigation().extras.state) {
this.navParams = this.router.getCurrentNavigation().extras.state.parms;
}});
}