AbstractControl,
AbstractControlOptions,
AsyncValidatorFn,
- FormGroup,
+ UntypedFormGroup,
NgForm,
ValidatorFn
} from '@angular/forms';
/**
* CdFormGroup extends FormGroup with a few new methods that will help form development.
*/
-export class CdFormGroup extends FormGroup {
+export class CdFormGroup extends UntypedFormGroup {
constructor(
public controls: { [key: string]: AbstractControl },
validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null,
showError(controlName: string, form: NgForm, errorName?: string): boolean {
const control = this.get(controlName);
return (
- (form.submitted || control.dirty) &&
+ (form?.submitted || control.dirty) &&
(errorName ? control.hasError(errorName) : control.invalid)
);
}