ng-maxlength issues in angular 1.4.12

140 Views Asked by At

Previously in angular 1.3.20 I could write a directive that accepted the ng-maxlength attribute, and apply it to an input inside its template. The HTML with the template inserted would look like this:

<my-directive ng-maxlength="5">
    <input type="text" maxlength="{{ngMaxlength}}">
</my-directive>

I've since updated to angular 1.4.12 and now my directive has the maxlength error flag set, when it is initially populated with the number 0 (I don't think this matters, just mentioning). As soon as I change the value by typing inside the input, ng-maxlength starts working as expected.

I've found through some trial and error that if I change the attribute name to say test-maxlength, all becomes well.

I have made two codepens to check out, one using 1.3.20 and one using 1.4.12. They both have two examples one with ng-maxlength and one with test-maxlength. If anyone has any ideas what is happening here that'd be great thanks!

[v1.3.20] http://codepen.io/jwt02180/pen/GqjpoG/

[v1.4.12] http://codepen.io/jwt02180/pen/eZPyNB/

0

There are 0 best solutions below