Suggest an editImprove this articleRefine the answer for “How do you check if a control has an error?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)You can check whether a control has an error using the **`hasError()`** method or the **`errors`** property. **Key point:** if `errors` is `null`, there are no errors; if it is an object, validation has failed.Shown above the full answer for quick recall.Answer (EN)ImageYou can check whether a control has an error using the `hasError()` method or the `errors` property. Examples: **1. Via** `hasError()`**:** ```typescript this.form.get('email')?.hasError('required'); // true if the required error is present ``` **2. Via the** `errors` **property:** ```typescript this.form.get('email')?.errors; // returns an object like { required: true, email: true } or null ``` **3. In the template:** ```html <input formControlName="email"> <div *ngIf="form.get('email')?.hasError('required') && form.get('email')?.touched"> Field is required </div> ``` If `errors` is `null`: there are no errors. If it is an object: validation has failed.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.