Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ionic 3 validation is not working on “invalid && dirty”

$
0
0

@stemsoftware wrote:

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.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>