Angular2 reactive forms show error messages based on validation fail condition

Your code only checks if the form control is dirty and invalid. But you want to check if a specific validation fails. So you need to pass an additional error argument ('required', 'minlength', etc.), and use

form.get(field).hasError(error)

I am answering this a little late, but I found a solution that is part of the angular materials modules that I really liked. If you implement your fields using "mat-form-field" you can easily display the error messages using a "mat-error" containing spans with an *ngIf.

I figured I should put it out there for other people trying to implement validator error messages. It makes the HTML a little beefy but it looks really nice.

<form [formGroup]="myForm" (ngSubmit)="submitForm()">
        <mat-form-field>
            <input matInput formControlName="user_input">
            <mat-error>
                <span *ngIf="myForm?.controls.user_input?.errors?.required">Required Field</span>
                <span *ngIf="myForm?.controls.user_input?.errors?.minLength">Minimum Length is 5</span>
            </mat-error>
        </mat-form-field>
</form>

The documentation is found here: https://material.angular.io/components/form-field/overview#error-messages