(control: FormControl, dir: NgControl)
| 161 | * @param dir Corresponding directive instance associated with this control. |
| 162 | */ |
| 163 | export 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. |
no test coverage detected
searching dependent graphs…