hueitan / angular-validation

[INACTIVE] Client Side Validation for AngularJS 1. (You should use version > 2 :boom:)
http://hueitan.github.io/angular-validation/
703 stars 176 forks source link

Using model value #271

Closed zvaraondrej closed 7 years ago

zvaraondrej commented 7 years ago

Allows user to specify, weather to use $viewValue or $modelValue for evaluation when form is submitted.

By default uses $viewValue; by adding use-view-value="false" forces to use $modelValue;

This need raises from a need of localized number inputs, which have to be stored in a $viewValue as a string (e.g. "2 000,0"), however in a $modelValue they are stored as a properly formatted number (2000). This can be done by using a custom directive with properly specified $formatters and $parsers.

hueitan commented 7 years ago

yes, this is a real need case. can you remove those unwanted indent/format commit?

zvaraondrej commented 7 years ago

Okay, now I see where was the unwanted indentation. It came by mistake, sorry. It should be fixed now.

hueitan commented 7 years ago

There are still some conflicts over the file, do you mind pull the latest from master, and run the grunt build again?

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.02%) to 93.976% when pulling c538ea9dbdce4830a8dec65aac06220f3f8b1003 on zvaraondrej:using-model-value into aa13b20b0e09fd42e5d78ce0565511ed6c9525c5 on huei90:master.

zvaraondrej commented 7 years ago

Seems like it should be fine now. What do you think? :)

hueitan commented 7 years ago

yep, done! 🍻

hueitan commented 7 years ago

There is one more thing we can improve, try to add the explanation in Q&A section.

with the explanation you given above

Allows user to specify, weather to use $viewValue or $modelValue for evaluation when form is submitted. By default uses $viewValue; by adding use-view-value="false" forces to use $modelValue; This need raises from a need of localized number inputs, which have to be stored in a $viewValue as a string (e.g. "2 000,0"), however in a $modelValue they are stored as a properly formatted number (2000). This can be done by using a custom directive with properly specified $formatters and $parsers.

zvaraondrej commented 7 years ago

It seems like I had to create a new PR for this one, so there's another opened...