子組件時,在我目前的項目如何隱藏父組件,我有以下幾點看法裝在角2
頁面加載時,將Parent Item Description
應該可見,Selected sub item description
不應該可見。
當我選擇Sub Item x
時,應該隱藏Parent Item Description
,只有Selected sub item description
可見。
我創建了以下路線此
{
path: 'main/:id',
component: MainComponent,
children: [
{
path: '',
component: MainComponent,
pathMatch: 'full',
},
{
path: 'sub/:id',
component: SubComponent
}
]
},
但運行該項目時,工作deosn't我所期待的方式。
我添加了一個<router-outlet></router-outlet>
加載分項說明,但是當我去的主要項目,本身內部的router-outlet
複製的主項的任何幫助,將不勝感激僅加載所選項目的描述右邊。
NG秀=父項,NG-顯示=「選擇」所選子項文本會做你需要的東西(當然,你需要填充選定的屬性) –
@JoaozitoPolo是的它會解決,但我想知道是否有可能實現與路由器出口 – Mujahid
你可以創建一個plunker或jsbin與功能代碼?現在我通過router-outlet瞭解你的想法。 –