Angular 仅当使用[routerLink]时,从导航组件中的链接路由到命名出口失败

Angular 仅当使用[routerLink]时,从导航组件中的链接路由到命名出口失败,angular,angular-ui-router,Angular,Angular Ui Router,当我尝试使用html中的此链接路由到指定的出口时,我的应用程序收到错误: <a [routerLink]=.../> 在html中更改为此 <a [routerLink]="['',{ outlets: { center: ['gi', 10] } }]" > GI Link </a> 由于已在根级别配置路由,因此必须将命名路由器出口移动到app.component.html app.module.ts app.component.html 请不要只发布

当我尝试使用html中的此链接路由到指定的出口时,我的应用程序收到错误:

<a [routerLink]=.../> 

在html中更改为此

<a [routerLink]="['',{ outlets: { center: ['gi', 10] } }]" > GI Link </a>

由于已在根级别配置路由,因此必须将命名路由器出口移动到app.component.html

app.module.ts

app.component.html


请不要只发布代码作为答案,而是解释代码的作用以及如何解决问题。带有解释的答案通常质量更高,更有可能吸引更多的选票。Chellappan,谢谢你提供的工作示例。添加到路由器链接起作用。
<a [routerLink]="['',{ outlets: { center: ['gi', 10] } }]" > GI Link </a>
const routes: Routes = [
      { path: 'car/:id', component: CarComponent},
      { path: 'gi/:otherId', component: GIComponent, outlet: 'center'}
]
  <a [routerLink]="['car', '9']" > Car Link </a>
    <router-outlet></router-outlet>   
    <router-outlet name="center"></router-outlet>