formly-js / angular-formly

JavaScript powered forms for AngularJS
http://docs.angular-formly.com
MIT License
2.22k stars 404 forks source link

Number Input is broken with Angular 1.3.3 #130

Closed Bill77 closed 9 years ago

Bill77 commented 9 years ago

In case others ran into this issue, I figured I'd post since it took a while for me to figure it out. Basically if you're running Formly with Angular 1.3.x the numeric inputs will not be updated to the ng-model because they are invalid. It seems that their ng-maxlength gets set to 0 by default. If you set an explicit value this fixes the issue, although it's not ideal.

This issue seems to be part of what Angular is doing (setting maxlength to 0 if it's null) along with how Formly is setting the maxlength (by default if maxlength is not specified, the attribute is still set to null). It should hopefully be fixed in 1.3.4, although I have not tested the PR yet.

Thanks, Bill

Here is the link to the Angular pull request for 1.3.4: https://github.com/angular/angular.js/pull/9998

Example of what I'm talking about; http://plnkr.co/edit/SJY6CofpRMhvPAo9hHpu

kentcdodds commented 9 years ago

Thank you. This is great news that it'll be fixed (hopefully) in 1.3.4 :-)

Bill77 commented 9 years ago

Hey @kentcdodds,

Just wanted to let you know I just tested 1.3.4 and the number and maxlength issue is fixed.

Bill

kentcdodds commented 9 years ago

:clap:

sucheendra commented 9 years ago

I am new to angular and formly, however I am using heavily angular formly. I will get stuck in ever new requirement. 1) I am having hard time to set input type control to allow only decimal value how do I achieve this? I don’t want user enter text when it currency field. 2) Second I have dialog opens from main page where the validator function triggers however I don’t see any visual indication (Color change in control).

sucheendra commented 9 years ago

your help is much appreciated if these things not get solved I need to write all the page in plain html with angular, which I don't want to do. Please help me.

kentcdodds commented 9 years ago

Hi @sucheendra, the best way to get help is to follow the instructions here: http://help.angular-formly.com

For your first question, you'll simply set the type property in templateOptions to number and that should do it for you.

For your second question, please go to that help link and create an example of what you mean.

sucheendra commented 9 years ago

It helped

Thank you Kent,

Thanks & Regards, Suchi

On Mon, Oct 5, 2015 at 11:08 AM, Kent C. Dodds notifications@github.com wrote:

Hi @sucheendra https://github.com/sucheendra, the best way to get help is to follow the instructions here: http://help.angular-formly.com

For your first question, you'll simply set the type property in templateOptions to number and that should do it for you.

For your second question, please go to that help link and create an example of what you mean.

— Reply to this email directly or view it on GitHub https://github.com/formly-js/angular-formly/issues/130#issuecomment-145563292 .