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 b37c158eea
commit 9223abc1f8

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) {