Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the text box to display a number with 2 digits after the decimal point? #32

Open
Xteda87 opened this issue Aug 25, 2016 · 4 comments

Comments

@Xteda87
Copy link

Xteda87 commented Aug 25, 2016

Hi!
Sorry for my bad English.

Actually the problem - I need to output to other inputs of calculation and would like to see the number there were two decimal places

For example 1.10 instead of 1.1
http://screencast.com/t/EwWXrUyIJMb
thank you in advance

@uhlryk
Copy link
Owner

uhlryk commented Aug 28, 2016

This directive returns number. And therefore even if we return 1.10 then it will be visible as 1.1 . But to this package I also added filters. Filter allow to format output value. There is option to show zeros at the end.

For example this allow to show 1.10
{{value|awnum:2:'.':'round':'true':'true'}}

But Im not sure if it will work in other inputs. If no then you should in controller run filter to other model and new model pass to next input.

Please give me info how you solved it. Or if you have more questions I will help you.

@Xteda87
Copy link
Author

Xteda87 commented Aug 28, 2016

I tried to set the value in the input through the filter, but still zero rounds

input awnum num-int="6" num-thousand-sep="{{' '}}" num-neg="false" num-thousand="true" num-fixed="2" type="text" id="summ" ng-model="life.summ" ng-change="life.changeSumm()"
vm.summ = $filter('awnum')(100.30, 2,'.','round','true','true');

http://screencast.com/t/GOEMQIfcG1

Upd. the string is returned in the text field? If yes, then it may check for decimal separator characters. If 1, then at the end adding 0

@uhlryk
Copy link
Owner

uhlryk commented Sep 4, 2016

Ok, now I understand. Other input is also angular-dynamic-number.

Unfortunately right now it is impossible to set leading and trailing zeros.

Very likely this functionality may be very interesting in this module.
I need to think a little about it (behavior of cursor and UX). Maybe I will implement this functionality.

Thanks for this great idea. I will let you know what I decided.

@uhlryk
Copy link
Owner

uhlryk commented Dec 14, 2016

In latest version input with num-fixed equal true, shows what you want. I didn't tested if this can be value from other directive. Please check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants