Router navigate to child route - Angular 6

后端 未结 6 584
半阙折子戏
半阙折子戏 2021-01-17 21:54

I\'ve defined my routes like this:

const routes: Routes = [
    { path: \'\', loadChildren: \'./tabs/tabs.module#TabsPageModule\' },
    { path: \'faq\', lo         


        
6条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-17 22:23

    this.router.navigate(['/list'], {relativeTo: this.route});      //absolute
    this.router.navigate(['./list'], {relativeTo: this.route});     //child
    this.router.navigate(['../list'], {relativeTo: this.route});    //sibling
    this.router.navigate(['../../list'], {relativeTo: this.route}); //parent
    this.router.navigate(['tabs/list'], {relativeTo: this.route});
    this.router.navigate(['/tabs/list'], {relativeTo: this.route});
    

    You'll find here more information

提交回复
热议问题