javascript - How to pass the value from one page to another? (angular2) -


i have 3 links, when click on link move other page:

this.nav.setpages([this.nav.first(), nextpage]); 

how pass value 1 page another, depending on link clicked?

you must inject router in constructor:

constructor(public router: router) {} 

and in function want trigger nav, use:

this.router.navigate(['./nextcmp', {param: 3}]) 

than in nextcmp inject:

constructor(public params: routeparams) { params.get('param'); } 

plunker: https://plnkr.co/edit/y3xa2scgpglcu4hxhny8?p=preview


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -