Angular 将布尔变量传递到路由器出口

Angular 将布尔变量传递到路由器出口,angular,Angular,我有以下代码: App.component.ts public euskera: boolean; ngOnInit(): void { this.euskera=false; } setEuskera(){ this.euskera=true; } setCastellano(){ this.euskera=false; } public title: string public title_eus: string; @Inpu

我有以下代码:

App.component.ts

 public euskera: boolean;

ngOnInit(): void {

    this.euskera=false;
  }

  setEuskera(){
    this.euskera=true;
  }
  setCastellano(){
    this.euskera=false;
  }
  public title: string
  public title_eus: string;
  @Input() euskera:boolean=false;
要将euskera的值传递给路由器出口中的子级:

app.component.html

  <div id="content">
    <router-outlet [euskera]="euskera">
    </router-outlet>

  </div>
<div *ngIf="euskera">
  <h1>{{title_eus}}</h1>
</div>

<div *ngIf="!euskera">
  <h1>{{title}}</h1>
</div>
home.component.html

  <div id="content">
    <router-outlet [euskera]="euskera">
    </router-outlet>

  </div>
<div *ngIf="euskera">
  <h1>{{title_eus}}</h1>
</div>

<div *ngIf="!euskera">
  <h1>{{title}}</h1>
</div>

{{title_eus}}
{{title}}

如何通过路由器出口传递变量值,以从我的所有组件获取变量值,并让IFs进行匹配?

您可以尝试使用角度定位

编辑: 或者调用不同的组件