0
我正在使用Angular4。我有一些顯示在app.component模板中的BarComponent(幾乎所有頁面,就像菜單欄)。我想獲得「屬於」另一個組件的路由器參數,而不是BarComponent的子/孩子。
例如,我的路線:
從Angular中的另一個組件獲取路由器參數
/some-section-name/:id{here may be sub-routes}
我能得到這樣的:使用BarComponent內的角方法ID PARAM?
結構是這樣的:
|- app.component
|- bar.component
|- (lazy load) some section
|- here is the component that has this :id param
有趣的選擇,很好,它不關心嵌套級別。糟糕的時刻 - 遞歸,如果應用程序有很多孩子。但是,無論如何,這很有幫助。 – WeekendMan