Angular Forms: How to avoid multiple NgIf divs for validation error messages?
问题 I would like to simplify the code below: <div *ngIf="form1.errors?.checkDate && (form1.touched || form1.dirty)" class="cross-validation-error-message alert alert-danger"> Date can't be in the future. </div> <div *ngIf="form1.errors?.notAfterDate && (form1.touched || form1.dirty)" class="cross-validation-error-message alert alert-danger"> Birth Date must be after 1/1/1800. </div> It should have only 1 div *ngif and pass the error message as a value instead of hardcoding or use a ngFor ? Any