Skip to content

Commit ac09e37

Browse files
devversionandrewseguin
authored andcommitted
refactor(checkbox): remove unused host binding for required validator (#16548)
Currently the `mat-checkbox` required validator defines a host binding that adds the "required" attribute to the `mat-checkbox` host element. This is not necessary as the `required` attribute should be only added to the underlying input element (which is handled as part of the checkbox template). This unnecessary host binding seems to have been added by accident since the `CheckboxRequiredValidator` from `@angular/forms` has the same host binding. Through the difference is that the `CheckboxRequiredValidator` from `@angular/forms` is guaranteed to have native input elements as host element.
1 parent 12db44e commit ac09e37

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/material/checkbox/checkbox-required-validator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ export const MAT_CHECKBOX_REQUIRED_VALIDATOR: Provider = {
3131
selector: `mat-checkbox[required][formControlName],
3232
mat-checkbox[required][formControl], mat-checkbox[required][ngModel]`,
3333
providers: [MAT_CHECKBOX_REQUIRED_VALIDATOR],
34-
host: {'[attr.required]': 'required ? "" : null'}
3534
})
3635
export class MatCheckboxRequiredValidator extends CheckboxRequiredValidator {}

0 commit comments

Comments
 (0)