MCPcopy Index your code
hub / github.com/angular/angular / setUpDisabledChangeHandler

Function setUpDisabledChangeHandler

packages/forms/src/directives/shared.ts:163–176  ·  view source on GitHub ↗
(control: FormControl, dir: NgControl)

Source from the content-addressed store, hash-verified

161 * @param dir Corresponding directive instance associated with this control.
162 */
163export function setUpDisabledChangeHandler(control: FormControl, dir: NgControl): void {
164 if (dir.valueAccessor!.setDisabledState) {
165 const onDisabledChange = (isDisabled: boolean) => {
166 dir.valueAccessor!.setDisabledState!(isDisabled);
167 };
168 control.registerOnDisabledChange(onDisabledChange);
169
170 // Register a callback function to cleanup disabled change handler
171 // from a control instance when a directive is destroyed.
172 dir._registerOnDestroy(() => {
173 control._unregisterOnDisabledChange(onDisabledChange);
174 });
175 }
176}
177
178/**
179 * Sets up sync and async directive validators on provided form control.

Callers 1

Calls 2

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…