如何解决选择单选按钮后刷新 Angular 组件
我正在尝试在更改 mat 单选按钮组的值后刷新包含 mat-cards 的组件(在 html 中通过 )。不知何故,我无法使更改事件和以下重定向工作:
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']));
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。