![](/img/trans.png)
[英]How to pass variable value from one component to another in Angular2
[英]How to pass the value from one page to another in Angular?
我有3個鏈接,當我單擊任何鏈接時,我會移至其他頁面:
this.nav.setPages([this.nav.first(), NextPage]);
如何根據單擊的鏈接將值從一頁傳遞到另一頁?
您必須更改功能代碼:
this.router.parent.navigate(['/PreviousDetailsCmp' {value1:abc, value2:xyz}]);
以及要在何處使用此參數值注入RouteParams:
constructor(public params: RouteParams){
this.val1 = params.get('value1')
this.val2 = params.get('value2')
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.