Refresh Angular-Component after Radio Button Selection

Viewed 307

I am trying to refresh a component (in html via ) that includes mat-cards after changing the value of a mat radio button group. Somehow I cant get the change-event and the following redirection to work:

app.component.html:

<mat-radio-group
  aria-labelledby="example-radio-group-label"
  class="example-radio-group"
  [(ngModel)]="Sprache"
  (change)="radioChange($event)">
  <mat-radio-button class="example-radio-button" *ngFor="let season of sprachen" [value]="season">
    {{season}}
  </mat-radio-button>
</mat-radio-group>

app.component.ts:

import { Component} from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'Juliens MEAN-Pokedex';
  showFiller = false;

  Sprache: string;
  sprachen: string[] = ['de', 'en', 'fr', 'ja', 'kr', 'zh'];

  constructor(private router: Router){
  }


  radioChange(e){
    this.router.navigateByUrl('/', {skipLocationChange: true}).then(()=>
    this.router.navigate(['Dashboard']));
  }

}
0 Answers
Related