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
Post a Comment