我正在尝试路由到指定的 socket ,但我无法这样做。我已经修改了官方的 angular plunk(要演示的危机示例)。
我在 crisis-center.component 中创建了一个名为 outlet 的“detail”,并修改了 Admin 链接以路由到这个新的 outlet
<a [routerLink]="['/crisis-center/detail:admin']">Crisis Admin</a>
这是行不通的。它导航到组件管理员,但在默认 socket 中,我也尝试使用导航方法,但也有类似的问题。
http://plnkr.co/edit/KXOGwX8bW0AYc86OgVdQ?p=preview
我也尝试在管理路由定义中添加 socket ,但仍然是同样的问题
`{
path: 'admin',
component: CrisisAdminComponent,
outlet: 'detail',
canActivate: [AuthGuard]
}`,
@angular/路由器:3.0.0-alpha.7
=======编辑:======
@angular/路由器:3.0.0-alpha.8
我已经更新了 plunker https://plnkr.co/edit/Kn4yBi5oytNVcFvUvGLR?p=preview . 现在我在指定的管理 socket 中加载管理组件
使用 navigateByUrl 时,控制台出现以下错误。
`platform-browser.umd.js:2311 EXCEPTION: Error: Uncaught (in promise): Error: Cannot match any routes: 'crisis-center/admin:admin'`
最佳答案
更新
有一个fix on it's way登陆 RC.5
原创
routerLink
尚不支持命名<router-outlet>
.
与 router.navigateByUrl()
这已经可以实现,但辅助路由没有得到完全支持,并且有几个已知问题。
示例:
this._router.navigateByUrl("/crisis-center(aux:chat;open=true)");
关于 Angular 路由器 v3 : targeting named outlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38012162/