Skip to content
Advertisement

Pass value to an other compoment via routerLink in Ionic

I would like to pass value to another compoment ex: a name of country, and use it on the other compoment

I make the link like that and i want to send the value “France” to another compoment (via dataHere) :

JavaScript

How can i do that ?

Advertisement

Answer

in you html file

JavaScript

and in your ts file
JavaScript

and in your result.page.ts file

JavaScript

But I don’t recommend this work around. Instead use “service”. Your can pass data from one page to another this way. Learn more about service in https://edupala.com/ionic-service/

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement