fix(angular): resolve issue when not using ngModel on components

This commit is contained in:
Liam DeBeasi
2020-06-11 10:04:58 -04:00
parent 1c0b3003a3
commit 4083e32e10

View File

@@ -62,7 +62,12 @@ export class ValueAccessor implements ControlValueAccessor, AfterViewInit, OnDes
}
ngAfterViewInit() {
const ngControl = this.injector.get<NgControl>(NgControl as Type<NgControl>);
let ngControl;
try {
ngControl = this.injector.get<NgControl>(NgControl as Type<NgControl>);
} catch { /* No FormControl or ngModel binding */ }
if (!ngControl) { return; }
// Listen for changes in validity, disabled, or pending states
if (ngControl.statusChanges) {