Implement error handling for the create qualification form #19
@ -6,6 +6,7 @@ import {NgIf} from "@angular/common";
|
||||
import {MatError, MatFormField, MatLabel} from "@angular/material/form-field";
|
||||
import {MatButton} from "@angular/material/button";
|
||||
import {MatInput} from "@angular/material/input";
|
||||
import {filter} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-qualification',
|
||||
@ -39,7 +40,7 @@ export class CreateQualificationComponent {
|
||||
const field = this.qualificationForm.get(fieldName);
|
||||
|
||||
if (!field) {
|
||||
return false;
|
||||
throw new Error('Form field does not exist: ' + fieldName)
|
||||
}
|
||||
|
||||
return field.invalid && (field.dirty || field.touched);
|
||||
|
Reference in New Issue
Block a user