Skip to content

Commit 91c2202

Browse files
committed
fix(material/checkbox): add the boolean property coercion for checked input
1 parent 4ef3d3f commit 91c2202

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/material/checkbox/checkbox.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,9 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
244244
@Input()
245245
get checked(): boolean { return this._checked; }
246246
set checked(value: boolean) {
247-
if (value != this.checked) {
248-
this._checked = value;
247+
const checked = coerceBooleanProperty(value);
248+
if (checked != this.checked) {
249+
this._checked = checked;
249250
this._changeDetectorRef.markForCheck();
250251
}
251252
}
@@ -490,6 +491,7 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
490491
}
491492
}
492493

494+
static ngAcceptInputType_checked: BooleanInput;
493495
static ngAcceptInputType_disabled: BooleanInput;
494496
static ngAcceptInputType_required: BooleanInput;
495497
static ngAcceptInputType_disableRipple: BooleanInput;

0 commit comments

Comments
 (0)