Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Few questions about directives
Message
 
 
À
26/02/2015 11:54:26
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01615790
Message ID:
01615887
Vues:
39
>>>I thought I'd posted something after this but anyway:
>>>
>>>I tested using both positive and negative priority and your directive always ran first. I *did* get it to work by changing your formatter to:
>>>                    function bind() {
>>>                        return ngModel.$formatters.unshift(function (value) {
>>>                            return format(value);
>>>                        });
>>>                    }
Don't know why the priority approach didn't work but this shows that your formatter needs to be first in the $formatters array.....
>>
>>Wow, thanks for the clever solution, Viv. Seems like that error is gone although I'll do more tests.
>
>It's OK in this case since you always want your formatter to run after the angular one - but if you ever want to add another formatter after it then you are back to square one - i.e. needing to control the order of the relevant directives.
>
>Wish I knew why setting priority doesn't seem to work :-{

Could it be a bug? BTW, would you agree that for numberInput we probably don't need to check for actual number, we may just check for the value (could be a string) being a number. If that code would have checked that instead of isNumber function, then I would not have a problem.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform