我正在构建一个具有辅助路由的Angular2应用。我正在使用此插件(http://plnkr.co/edit/jZv8jj?p=preview)帮助我进行设置,但是我需要将参数传递给aux链接。我怎么做?(注意:本示例使用旧的哈希路由,我使用的是新的html5,但在任何一种方法中均不起作用)。
@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 href="./#/(chat)">Chat</a>`,
directives: [ ROUTER_DIRECTIVES]
})
@RouteConfig([
{path: '/', component: HomeComponent, as: 'Home'},
{path: '/product', component: ProductDetailComponent, as: 'ProductDetail' },
new AuxRoute({path: '/chat', component: ChatComponent, as: 'Chat'})
])
好的,我知道了...我不确定这是正确的方法,但是当我从辅助路径中删除参数时,即:
{aux:'/memory', name: 'Memory', component: MemoryComponent}
代替
{aux:'/memory/:id', name: 'Memory', component: MemoryComponent}
工作正常!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句