Skip to content

Commit aa17c2d

Browse files
authored
fix(multiple): remove workarounds for formControl directive (angular#29296)
The formControl directive previously did not mark itself for check, so several components that work closely with this directive marked for check on its behalf as a workaround. Now that the directive is fixed we can remove the workarounds.
1 parent 2c88e9b commit aa17c2d

File tree

4 files changed

+2
-16
lines changed

4 files changed

+2
-16
lines changed

src/material/autocomplete/autocomplete-trigger.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ export class MatAutocompleteTrigger
462462
// Implemented as part of ControlValueAccessor.
463463
setDisabledState(isDisabled: boolean) {
464464
this._element.nativeElement.disabled = isDisabled;
465-
this._changeDetectorRef.markForCheck();
466465
}
467466

468467
_handleKeydown(event: KeyboardEvent): void {

src/material/chips/chip-grid.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
EventEmitter,
2222
Input,
2323
OnDestroy,
24-
OnInit,
2524
Optional,
2625
Output,
2726
QueryList,
@@ -91,8 +90,7 @@ export class MatChipGrid
9190
ControlValueAccessor,
9291
DoCheck,
9392
MatFormFieldControl<any>,
94-
OnDestroy,
95-
OnInit
93+
OnDestroy
9694
{
9795
/**
9896
* Implemented as part of MatFormFieldControl.
@@ -280,14 +278,6 @@ export class MatChipGrid
280278
);
281279
}
282280

283-
ngOnInit() {
284-
if (this.ngControl) {
285-
this.ngControl.control?.events.pipe(takeUntil(this._destroyed)).subscribe(() => {
286-
this._changeDetectorRef.markForCheck();
287-
});
288-
}
289-
}
290-
291281
ngAfterContentInit() {
292282
this.chipBlurChanges.pipe(takeUntil(this._destroyed)).subscribe(() => {
293283
this._blur();

src/material/radio/radio.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ export class MatRadioGroup implements AfterContentInit, OnDestroy, ControlValueA
275275
_touch() {
276276
if (this.onTouched) {
277277
this.onTouched();
278-
this._changeDetector.markForCheck();
279278
}
280279
}
281280

tools/public_api_guard/material/chips.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export interface MatChipEvent {
172172
}
173173

174174
// @public
175-
export class MatChipGrid extends MatChipSet implements AfterContentInit, AfterViewInit, ControlValueAccessor, DoCheck, MatFormFieldControl<any>, OnDestroy, OnInit {
175+
export class MatChipGrid extends MatChipSet implements AfterContentInit, AfterViewInit, ControlValueAccessor, DoCheck, MatFormFieldControl<any>, OnDestroy {
176176
constructor(elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef, dir: Directionality, parentForm: NgForm, parentFormGroup: FormGroupDirective, defaultErrorStateMatcher: ErrorStateMatcher, ngControl: NgControl);
177177
protected _allowFocusEscape(): void;
178178
_blur(): void;
@@ -211,8 +211,6 @@ export class MatChipGrid extends MatChipSet implements AfterContentInit, AfterVi
211211
ngDoCheck(): void;
212212
// (undocumented)
213213
ngOnDestroy(): void;
214-
// (undocumented)
215-
ngOnInit(): void;
216214
_onChange: (value: any) => void;
217215
onContainerClick(event: MouseEvent): void;
218216
_onTouched: () => void;

0 commit comments

Comments
 (0)