Angular 4: Multiple (named) router-outlets in a child route: supported?

前端 未结 1 735
情话喂你
情话喂你 2020-12-04 16:41

I have a master-detail setup with also another section for \"editing\" a list item, all on 1 landing-route (in my sample app, the route is /stuff). The detail component is

相关标签:
1条回答
  • 2020-12-04 17:21

    Apply these changes in the b.component.html and it should work as expected.

    <p>
      Detail section works! {{ index }}
     <button type="button"
       [routerLink]="['/stuff',{outlets:{editsection:':index/edit'}}]">Edit</button>
    </p>
    

    For dynamic URL, using the routerLink, first, mention which route you want to go and then define the outlets and sub-routes as shown.

    0 讨论(0)
提交回复
热议问题