space checking with cutom directive fo reacitve form code example
Example 1: angular form validation whitespace
<div *ngIf="yourForm.hasError('whitespace')">Please enter valid data</div>
Example 2: angular form validation whitespace
new FormControl(field.fieldValue || '', [Validators.required, this.noWhitespaceValidator])