Replies
Hi Galina,
It seems I misunderstood some things about the ngModel. I'm now using this on the inner date inputs which solves a few problems and drops the need for some workarounds. In fact I think I now got it working correctly except for one thing: When the form loads the date fields are immediately marked as invalid. Is it possible to have them empty but without being already validated, like the required name field? Here is a new demo.
We were wondering if there has been any progress on this since it has been a few days since we've had a reply. Is the provided demo working and clearly showing the problem?
This has helped me a little but I'm still facing some issues.
Here is the correct link for the current version of my problem: https://stackblitz.com/edit/datepickerdemo
What has been added is the requirement that the form is invalid and cannot be submitted if the endDate comes before the startDate. I wrote a directive for this and put it on endDatePicker (it doesn't fire when I put it on the endDate input field in the template). I can see the directive work because if we set startDate to today and endDate to some days ago, the submit button becomes disabled, and also there is some info being printed to the console. But the endDatePicker does not get any invalid styles.
Thank you Galina, this workaround solves the issue for now. However I am still having trouble with the required state of the field. I have made a new demo to demonstrate the problem: https://datepickerdemo.stackblitz.io. As you can see as soon as you enter a name the save button becomes enabled, allowing you to bypass the date requirement. Is this another possible bug and would you know a workaround for it?
https://stackblitz.com/edit/angular-o4xsa9
I tried your suggestion, but that didn't work, since displayData is passed down from the igxDatePickerTemplate, but we need to bind to the date property in the ts file. So I experimented a bit more and came to the above linked stackblitz demo. The only problem remaining is that the first time picking a date, the field remains marked as invalid. This leads me to believe either I am still doing something wrong, or this could be a bug. Can you have a look and help me?