angular 2/4 routing with named outlet?

匆匆过客 提交于 2019-12-02 13:58:16

问题


I am trying to do implement named outlet in my app.

Here is my route config:

    {
    path: 'contact',
    children: [
      { path: '', component: ContactComponent, pathMatch: 'full' },
      { path: 'list', component: ContactlistComponent },
      { path: 'hold', component: ContactOperationComponent, outlet: 'popup' }      
    ]
  }

Here is Outlet which i have kept in AppComponent with main router-outlet

<router-outlet name="popup"></router-outlet>

And here is my routerLink which is calling my Component:

<a [routerLink]="['/contact',{outlets:{popup:['hold']}}]">Hold</a>

But, the URL is generated by this approach is a mess. Here it looks like this:

/contact/(list//popup:hold)

It should be like this

/contact/list(popup:hold)

and due to that i can't even access passed parameters to called Component.

What can be the issue here?

来源:https://stackoverflow.com/questions/46156139/angular-2-4-routing-with-named-outlet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!