I’m using Template Driven Angular Forms and I;m wanting to display an error in a div if the user touches the form element, but nothing is showing.
<ion-item class="formField"> <ion-label color="primary" stacked>Start Date</ion-label> <ion-datetime type="date" name="startDate" id="startDate" displayFormat="MM/DD/YYYY" ngModel #startDate="ngModel"> </ion-datetime> </ion-item> <div> <ion-label *ngIf="startDate.invalid && dirty">Test</ion-label> </div>
I was testing with different approaches, but I could never get the div to show with no errors. Is this functionality not working in ionic or am I doing something wrong? I was thinking about using Reactive Forms, but I wanted to be sure this wasn’t working first.