Open Xteda87 opened 8 years ago
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.
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
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.
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.
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