>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.
If it's not broken, fix it until it is.
My Blog