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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -