Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngMinlength and ngMaxlength attribute not bind value, when model value is type Number #5936

Closed
@vitorlopez

Description

@vitorlopez

cdc4d48#diff-c244afd8def7f268b16ee91a0341c4b2R514

I was reading the commit above, and i have a question...

In the previous code, if the 'value' was type Number, the '.length' property return 'undefined'. So instead of go in the 'if' condition, go in the 'else'.

But in this new condition 'ctrl.$isEmpty(value) || value.length', if the 'value' is a Number, then the condition will return false. Then the validation wont pass. But in the previous condition the same case pass correctly.

My question is: This behavior was intentional? Because i understand if i want a field with a number value i can use input type="number" and then use the 'min' and 'max' attributes. But the layout that i get for this type of input is different in each browser, and some times doesnt fit in the design of the app.

If i am right, i can submit a pull request do help with this, but first i have to be sure that this behavior wasnt intentional.

This example uses Angular 1.2.7 and will success the validation:
http://plnkr.co/edit/YRpqT6Dwc6xbe2LYHEwq

This example uses Angular 1.2.8 and will fail the validation: http://plnkr.co/edit/rZgEtjyDuErDro9K94Q3

The same will apply for 'maxlength' attribute.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions