我正在尝试创建一个带有聊天窗口辅助路由的应用程序。该应用程序在加载时失败。这看起来像是一个错误,我在 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)');
关于angular-routing - Angular 2 辅助路由器坏了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33442363/