Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date input as a text type
Message
De
14/08/2014 11:36:34
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01605625
Message ID:
01605693
Vues:
33
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform