Active validator with ng if


down vote
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-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>
 <span class="error" *ngIf="generalForm.get('environnement').value == 'another' && generalForm.controls.Humidity.errors" > required </span>