简体   繁体   中英

how to navigate to a named router-outlet by running a function on click? in Angular 4?

i used this method to navigate to named router-outlet => ( link -> [routerLink]="[{ outlets: { 'dashboard': ['userprofile'] } }] & Router-oulet -> ) , now how can i navigate to this router by a function? or how to use outlet name in "this.router.navigate" ?

route to this ->

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

by this link in html template ->

[routerLink]="[{ outlets: { 'dashboard': ['userprofile'] } }]

now, how can i navigate to the dashboard router-outlet by running a function? using this.router.navigate?

It should look more or less like:

this.router.navigate([{outlets: {'dashboard':'userprofile'}}],{
  relativeTo: this.route
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM