2017-08-15 2 views
0

私はルートActivatedRouteモジュールを使って名前付きルートから2次ルートアウトレットを取得しようとしています。例えばセカンダリアウトレットでプライマリルート出口パラメータを取得することは可能ですか?

現在のURL:http://localhost:4200/dashboard/contraceptives/(assessment:5991780301d88a211e86e012//details:599062793f86454d43896255)

店:

<div class="col m4 z-depth-3"> 
    <router-outlet name="details"></router-outlet> 
</div> 
<div class="col m4 z-depth-3"> 
    <router-outlet name="assessment"></router-outlet> 
</div> 

コンポーネント:

私はこの現在のコンセントとコンポーネントに詳細のparamsを取得できますか?私は道見つかったために管理

ngOnInit() { 
    this.sub = this.route.params.subscribe(params => { 
     this.id = params['id']; 
    }); 
    } 
+0

あなたに必要なの[アクティブ化ルートをトラバース](https://angular.io/api/router/ActivatedRoute#parent) –

答えて

-1

constructor(router:Router){ 
    RouterLinks.events(event=>{ 
     // here i am subscribing to the events 
     const primaryRouter = event.state.root.firstChild; 
     // where first child is the primary router-outlet 
    }) 
} 
+0

は、SOへようこそあなたの答えを説明してください。コードスニペットを投稿するだけでなく – cSteusloff

関連する問題