我正在尝试更新我的应用程序以使用新的 v3 路由器,而不是 Angular 团队刚刚宣布的 http://angularjs.blogspot.com.au/2016/06/improvements-coming-for-routing-in.html我在我的应用程序的页面之间导航时遇到问题,这是我的路线
{ path: '/list', component: UserListComponent, index: true},
{ path: '/payrates', component: AdjustPayrateComponent },
{ path: '/assign', component: AssignUserComponent },
{ path: '/edit/:userId', component: EditUserComponent },
{
path: '/documents',
component: DocumentComponent,
children: [
{ path: '/', component: DocumentComponent, index: true },
{ path: '/:id', component: DocumentComponent },
{ path: '/upload', component: DocumentUploadComponent }
]
},
我想从/list 页面导航到/documents/:id 页面以查看列表页面上用户的文档。
viewDocuments(user: UserList) {
this.router.navigate(['/documents', { id: user.UserId }], { relativeTo: this.route });
}
但是我收到错误消息“Outlet is not activated”并且不确定这意味着什么。我的应用程序基于 http://plnkr.co/edit/ER0tf8fpGHZiuVWB7Q07?p=preview 的示例
如果有人对如何使用新路由器进行导航有任何示例或建议,我们将不胜感激,谢谢!
最佳答案
解决了问题,我有一个剩菜<router-outlet>
我的列表页面中的指令,我想当尝试从该页面导航时,路由器试图加载到那个坏 socket 。
关于javascript - 路由器导航 : Outlet is not activated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37862807/