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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -