Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date input as a text type
Message
From
14/08/2014 11:36:34
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01605625
Message ID:
01605693
Views:
34
This message has been marked as a message which has helped to the initial question of the thread.
>>>The problem is that I can type any garbage text in the date field. The date is not saved in this case, but I'd rather have it automatic validation for valid date format. I know there is HTML 5 date type, but it doesn't work in our situation as this directive should work for both date and datetime and also it has its own date picker which is called from an extra button.
>>>
>>>So, do you know what can be done to make sure the input is correct date?
>>
>>You probably a directive with custom validation - there's an example in the 'Custom Validation' section here :
>>https://docs.angularjs.org/guide/forms
>
>Great, thanks a lot. Hope I (or someone) will be able to work it out.

Pretty straightforward.
ctrl.$parsers.unshift adds the function to the beginning of the pipeline that will be called when control content changes.
In the function you just need to do the ctrl.$setValidity true/false.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform