I want to get errors message in function of component instead show them in template:
<p [hidden]="!name.control.errors.required" *ngIf="name?.control?.errors?.required">name is required</p>
How to get errors message of form in function of Component?