angular-dynamic-number
angular-dynamic-number copied to clipboard
num-fixed as option (not filter)
It's not clear to me how to use numFixed filter in an input field built like this:
<input awnum num-int="6" num-fract="2" num-sep="," num-thousand="true" num-thousand-sep="." num-neg="false" num-round="round" num-pos="true" num-prepend="" num-append="" ng-trim="false" ng-init="moduloCtrl[dynindex] = 2.00" ng-model="moduloCtrl[dynindex]" />
This field will show '2' and not ('2,00').
Debugging dynamic-number.js, in filterModelValue function I can see that numFixed is by default set to false. To obtain the desired result I have to set numFixed variable to true. How I should use numFixed filter in this case? If not possible, is it possible to set the default value of numFixed to true or also better make it work also as option (attribute of input text field)?
Hey In previous versions it was impossible. Now it may work. I will check it within a few days
thanks. Here is an example: https://plnkr.co/edit/zenr0zqZF1Q1RGZWsQLx?p=preview
Please check latest version, I think I done it. I also used your example with latest source : https://plnkr.co/edit/7Ss7ad0dSOWY7choo7ei?p=preview
Thanks, it works! However in my example awnum was, wrongly, set to 'true'. This triggers the error 'strategy is undefined'
Reopened, because using num-fixed, every value has decimal separator so typing separator is ignored.
https://plnkr.co/edit/7Ss7ad0dSOWY7choo7ei?p=preview
As you can see, user have to manually move after separator using arrow key or clicking. I think that, when separator key is typed, caret should move after decimal separator. I've implemented a solution that seems to work in link function of directive (after comment '//on num-sep move caret after decimal separator'):
https://plnkr.co/edit/8hLWSgeMtfyUABtzLsHK?p=preview
Thx for your feedback. Usually new functionality introduce some border cases. I just fixed this one.
THere is one issue with fixed option https://github.com/uhlryk/angular-dynamic-number/issues/41 Write what you think about it.