Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Few questions about directives
Message
De
25/02/2015 04:29:31
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01615790
Message ID:
01615807
Vues:
43
>>UPDATE. I'm thinking that we should not use both type="number" and our own directive at the same time as the directive seems to be doing what type="number" should be doing. I'll try removing type="number" and using type="text" and see if it fixes the problem.
>>
>>UPDATE 2. By changing input type="text" from input type="number" I got rid of the error. The only problem is that this is used in many places in our application, so we would need to change all of them.
>
>If I remove the input type="number" and change it to type = "text" then the min/max attributes are ignored. Is there a way to fix our directive to still generate the errors for min /max but keep type text as type number causing this error in angularjs 1.13.3 ?
>
>I also posted it as an issue on the angularjs site.
>
>UPDATE 3. I am thinking that we need to apply our formatting directive after the input type="number" directive is applied. According to this blog post
>
>https://coderwall.com/p/hpewqw/remember-angularjs-directives-can-have-priorities we may try using negative priority. So, this is going to be my new test - may be it will resolve the issue.
>
>UPDATE 4. So I've tried using
>
>app.directive('smNumberFormat', ['$filter', function ($filter) {
>        return {
>            restrict: 'A', // only activate on element attribute
>            require: '?ngModel', // get a hold of NgModelController   
>            priority: - 3, // apply this directive after the input type="number" is applied
>            link: function (scope, element, attrs, ngModel) {
>
>
>but unfortunately it didn't help with the problem and I still got the same error. Do you see a workaround for me?
>
>Thanks in advance.

Can you post the code for your smNumber directive ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform