Angular2 辅助路由器坏了吗?
Is Angular 2 Auxiliary router broken?
我正在尝试创建一个带有辅助聊天路径的应用 window。该应用程序在加载时失败。这似乎是一个错误,我在 Angular GitHub 上报告了它,但我想知道是否有人知道解决方法?这是这个简单应用程序的主要内容: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 { /* ... */ }
不清楚路由器如何知道要使用哪个命名路由出口。
您必须等到问题 https://github.com/angular/angular/issues/4694 得到解决。
当前的实现只允许
this.router.navigateByUrl('/(chat)');
我正在尝试创建一个带有辅助聊天路径的应用 window。该应用程序在加载时失败。这似乎是一个错误,我在 Angular GitHub 上报告了它,但我想知道是否有人知道解决方法?这是这个简单应用程序的主要内容: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 { /* ... */ }
不清楚路由器如何知道要使用哪个命名路由出口。
您必须等到问题 https://github.com/angular/angular/issues/4694 得到解决。
当前的实现只允许
this.router.navigateByUrl('/(chat)');