我已经在我的Angular 2应用程序中创建了一些子路线。
export const AFTER_LOGIN_ROUTES:Routes=[
{path:'',component:LatestPositionComponent},
{path:'add',component:AddNewFriendComponent},
{path:'history',component:HistoryComponent}
];当我访问http://localhost:4200/app/add或http://localhost:4200/app/history时,一切正常。
但是对于http://localhost:4200/app,我得到了一个错误:
EXCEPTION: Uncaught (in promise): Error: Error in :0:0 caused by: Cannot read property 'firstChild' of null
Error: Error in :0:0 caused by: Cannot read property 'firstChild' of null
at ViewWrappedError.ZoneAwareError有什么想法吗?
发布于 2017-03-13 21:33:23
如果您有一个没有子路由的空路径(''),请使用pathMatch: 'full'
{path:'',component:LatestPositionComponent, pathMatch: 'full'},https://stackoverflow.com/questions/42764872
复制相似问题