Skip to content

Commit 5916765

Browse files
authored
fix(material): adjust empty value for number/bool type (#1538)
1 parent 72a6b7f commit 5916765

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/material/form-field/src/field.type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export abstract class FieldType<F extends FormlyFieldConfig = FormlyFieldConfig>
7979
get value() { return this.formControl.value; }
8080
set value(value) { this.formControl.patchValue(value); }
8181
get ngControl() { return this.formControl as any; }
82-
get empty() { return !this.formControl.value; }
82+
get empty() { return this.value === undefined || this.value === null || this.value === ''; }
8383
get shouldLabelFloat() { return this.focused || !this.empty; }
8484
get formField(): MatFormField { return this.field ? (<any>this.field)['__formField__'] : null; }
8585
}

0 commit comments

Comments
 (0)