我想将默认值“checked”设置为mat-checkbox
@Input() set parkings(checked:boolean){
//stuff
}
还有我的HTML代码
<mat-checkbox checked [(ngModel)]="parkings">Parkings</mat-checkbox>
我想把它检查默认值
只需添加一个get
。
private _parkings: boolean = true;
get parkings(): boolean {
return this._parkings;
}
set parkings(checked: boolean) {
// stuff to set _parkings.
}