I m using Ionic datetime component in my ionic app
<ion-datetime
displayFormat="YYYY/MM/DD"
pickerFormat="YYYY MMMM DD" [(ngModel)]="summaryDate"
(ionChange)="getDashboardItemsByDate()">
</ion-datetime>
and in .ts file
I set default date to current date like this
public summaryDate: any = new Date().toISOString();
This works perfectly fine, but however the problem I have is, it invokes ionChange
event at the beginning (as I have set default value for this component). I just want to trigger this event when user selects the date not at the beginning when I set its default value.
Any help?
This should work fine
(ionChange)="changed($event)"
notice ($event)
Use (ngModelChange)
of angular instead of (ionChange)
It's a bug from ionic. https://github.com/ionic-team/ionic/issues/7806 Try updating ionic to the last version, maybe it's fixed. But the angular way will work just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With