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