I am new to angular 4 ,Here I am trying to implement angular form validation messages in my application .
Here the validation message is get displayed as expected but the text field and label color is not get changed based on the state.
HTML :
<form #AddressForm="ngForm" (ngSubmit)="SaveAddress(mAddress_Model)">
<div class="form-group" [class.has-error]="Name.invalid && Name.touched" [class.has-success]="Name.valid">
<label for="FName" class="control-label" >First Name *</label>
<input type="text" required minlength="4" id="Name" name="Name" class="form-control " [(ngModel)]="mAddress_Model.mFName" #Name="ngModel">
<div class="help-block alert-danger col-sm-12" *ngIf="Name.errors.required && Name.touched">
* First name is required
</div>
</div>
</form>
Here **[class.has-error]="Name.invalid && Name.touched" [class.has-success]="Name.valid"** not worked for me but the validation message div is working .
I followed this blog http://csharp-video-tutorials.blogspot.com/2018/01/displaying-angular-form-validation.html
Can anyone help me to solve this .
has-errorclass has been added, it sounds like the style hasn't. Are you using Bootstrap?