路由器导航:插座未激活
router navigation: Outlet is not activated
我正在尝试更新我的应用程序以使用新的 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>
指令,我想当尝试从该页面导航时,路由器正试图加载到那个坏插座。
我正在尝试更新我的应用程序以使用新的 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>
指令,我想当尝试从该页面导航时,路由器正试图加载到那个坏插座。