angular - routerLink with outlet redirects to 404 error page -
i have angular 4 application , not able set working routerlink
navigation. request gets redirected 404 error page.
here code:
the relevant part of route-config in ngmodule
:
{ path: 'transactions', component: transactionindexcomponent, children: [ { path: 'add', outlet: "next", component: transactionaddcomponent, children: [ { path: "addperson", component: personsaddcomponent, outlet: "next" } ] }, ] },
the relevant part of transactionsindexcomponent
template:
<a routerlink="[{ outlets: { next: 'add' } } ]" class="tile">add</a> <router-outlet name="next"></router-outlet>
the relevant part of transactionaddcomponent
template:
<a routerlink="[{ outlets: { next: 'addperson' } } ]" class="tile">add person</a> <router-outlet name="next"></router-outlet>
i tried these values routerlink
in transactionsindexcomponent
:
['', { outlets: { next: 'add' } } ]
[{ outlets: { next: 'add' } }]
none of them worked. what problem?
ps: templates self nested router-outlet
s working, because can open address /transactions/(next:add/(next:addperson))
without problems.
i found problem. missed square brackets in [routerlink]
. works well:
<a [routerlink]="[{ outlets: { next: 'add' } } ]" class="tile">add</a> <router-outlet name="next"></router-outlet>
Comments
Post a Comment