Form validation

<form [formGroup]="form">
<input [(ngModel)]="model.name" formControlName="name" matInput placeholder="Name">
  <div *ngIf="form.controls.name.invalid">
{{form.controls.name.errors.message}}
</div>
</form>

let controls = this.form.controls;        
for (var field in controls) {          
   controls[field].setErrors({
message: field + "aaaaa"
});
}