1
我試圖讓我的應用程序下面的網址迴應:必須多次聲明angular2路線?
/agent
/agent/login
/agent/travel
我能得到它,如果我使用下面的路線聲明(在一個單一的文件)的工作:
{ path: 'agent', component: AgentPage },
{
path: 'agent', component: AgentPage,
children: [
{ path: 'login', component: AgentLogin },
{ path: 'travel', component: AgentTravel }
]
},
{ path: '', component: AgentPage },
{ path: '**', component: NoContent }
如果我刪除第一路由定義/代理停止工作,我打了NoContent組件...
這是我agentPage.template.html:
<div>agentPage</div>
<router-outlet></router-outlet>
我真的不明白,爲什麼我需要從孩子分開兩個相同的聲明,並希望能夠在一個更乾淨的方式運行(即W/O第一路由定義)
有人能向我澄清這一點?
TIA
是的,我做了,但後來我得到了我的agentPage.template.html兩次顯示 - 將更新問題 – CJe