0
down vote
favorite
I’m applying validators using the form builder. I have a type that must be mandatory in a ng if The validation is not applied until after the verification of this ngif.
This is my implementation but it’s not working.
<div *ngIf="generalForm.get('environment').value == 'another'">
<ion-item>
<ion-label >Humidity</ion-label>
<ion-input type="text" placeholder=" Humidity" formControlName="Humidity"></ion-input>
<button ion-button clear item-right>
<ion-icon color="airlabtechcolor" ios="ios-create" md="md-create"></ion-icon>
</button>
</ion-item>
<span class="error" *ngIf="generalForm.get('environnement').value == 'another' && generalForm.controls.Humidity.errors" > required </span>
</div>