kstep/angular.js — comment on commit a08100e125402d8e32a540f5079117ca0bbf44cb
File:  line 0
By kstep:

By each point.

# Numbers are simple, it can limit number's length, not min/max numeric limit, that's partially why I decided not to leverage min/max properties, already used for numeric fields. As for date I don't know, maybe it has not sense for this type, but for most types (like url, email and password for example) it surely has sense, so I decided to put these validation in "input" widget for the DRY's sake.
# Many reasons. First I may need pattern for other purposes (like limit number of possibles chars, e.g. /^[A-Za-z_][A-Za-z_0-9]*$/. You may ask me why can't I set pattern to /^[a-z]{2,10}$/. I think it's semantically incorrect, as it hides my intention to apply size limits to the input widget behind pattern attribute. The other drawback is I can't distinguish "too short" and "too long" validation errors if I use pattern (at least not in easy way). Writing something like <input minlength="2" maxlength="10" /> make this intention obvious with a single glance and let me take different actions in case value is shorter than 2 and longer than 10.
# I considered this point as well. Minlength and maxlength are distinct antonyms and should go in pair IMHO, but maxlength is a standard attribute, unlike minlength (which is a shame, I always missed this attr). I could name them ng:minlength and ng:maxlength, but then I'd loose the benefit of browser validation on maxlength, so I decided on minlength and maxlength, which is distinctly interconnected. Your thoughts on it?
# I thought about min and max attributes as well. The problem I saw with them is they are already meant for numeric fields, and thus has distinct semantic meaning. And it can conflict with already existing code for numeric fields validation, confusing for developers and lead to subtle bugs. And more, I may want to put either minlength/maxlength or min/max validations on numeric field, and these are different things.

I certainly see your concern on non-standard minlength attribute. The only way to solve it, as I see it, rename it to ng:minlength, but then maxlength should be named ng:maxlength for nice symmetry. I just didn't want to loose browser support for maxlength, as I said above =) But well, I can write maxlength="10" ng:maxlength="10" as well. And, on second thought, it can have benefit of "soft maxlength" limitation, e.g. set maxlength="255" ng:maxlength="160" and display message like "Your message is quite long, don't you mind shorten it a little?" while have hard limit of 255.