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) {
this.route.navigateByUrl(`${intent}`, this.destination);
}
Receiver page line;
//private navParams:NavParams
this.destination = navParams.data;
What is the right approach to doing this in ionic 4. I am also uncertain whether gotoFinalView method is valid.
This is the efficient way to solve your problem user Angular Routers concepts in your application. just declare your router like the following
Your app routing module like the following
:id is the parameter what i want to send to that page.
share your parameter like this in your first page.
In your second page inject the activated route using DI(Dependency Injection)
Then Get your parameters using the following code
This is the simple way. You can send multiple parameter at a time.
and get those parameters like the following
While Routing you can write like this:
To get this parameters on the next page you can write:
This is how I solved my problem:
I created a Service with a setter and getter methods as;
Injected the Service and NavController in the first page and used it as;
Extracted the data at the final page by;
ionic 4 navigation with params
sender page 1. import the following
gotonextPage()
4.Receiver Page