为角2辅助路由器坏了? [英] Is Angular 2 Auxiliary router broken?
问题描述
我试图用一个聊天窗口辅助路线创建一个应用程序。该应用程序无法正确的加载。这似乎是一个错误,我报它角GitHub上,但我不知道是否有人知道解决方法吗?下面是这个简单的应用程序的普拉克: http://plnkr.co/edit/JsZbuR
I'm trying to create an app with an auxiliary route for a chat window. The app fails right on the loading. It seems like a bug and I reported it on Angular GitHub, but I wonder if anyone knows a workaround? Here's the plunk of this simple app: http://plnkr.co/edit/JsZbuR
@Component({
selector: 'basic-routing',
template: `<a [router-link]="['/Home']">Home</a>
<a [router-link]="['/ProductDetail']">Product Details</a>
<router-outlet></router-outlet>
<router-outlet name="chat"></router-outlet>
<a [router-link]="['/',['Chat']]">Chat</a>`,
directives: [ ROUTER_DIRECTIVES]
})
@RouteConfig([
{path: '/', component: HomeComponent, as: 'Home'},
{path: '/product', component: ProductDetailComponent, as: 'ProductDetail' },
{aux: '/chat', component: ChatComponent, as: 'Chat'}
])
class RootComponent{}
目前还不清楚路由器如何知道哪些命名的路由出口使用。
It's not clear how the router knows which named route outlet to use.
推荐答案
您必须等待,直到问题的 https://github.com/angular/angular/issues/4694 将迎刃而解。
You have to wait until the issue https://github.com/angular/angular/issues/4694 will be solved.
当前实现只允许
this.router.navigateByUrl('/(chat)');
查看链接 http://plnkr.co/edit/lquMdagaVfIoAT83w1pl?p= preVIEW
这篇关于为角2辅助路由器坏了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!