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

num-fixed as option (not filter) #38

Open
slillo opened this issue Dec 9, 2016 · 7 comments
Open

num-fixed as option (not filter) #38

slillo opened this issue Dec 9, 2016 · 7 comments

Comments

@slillo
Copy link

slillo commented Dec 9, 2016

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)?

@slillo slillo changed the title num-fixed ignored num-fixed as options (not filter) Dec 9, 2016
@slillo slillo changed the title num-fixed as options (not filter) num-fixed as option (not filter) Dec 9, 2016
@uhlryk
Copy link
Owner

uhlryk commented Dec 12, 2016

Hey
In previous versions it was impossible. Now it may work. I will check it within a few days

@slillo
Copy link
Author

slillo commented Dec 13, 2016

thanks. Here is an example: https://plnkr.co/edit/zenr0zqZF1Q1RGZWsQLx?p=preview

@uhlryk
Copy link
Owner

uhlryk commented Dec 13, 2016

Please check latest version, I think I done it.
I also used your example with latest source : https://plnkr.co/edit/7Ss7ad0dSOWY7choo7ei?p=preview

@slillo
Copy link
Author

slillo commented Dec 14, 2016

Thanks, it works! However in my example awnum was, wrongly, set to 'true'. This triggers the error 'strategy is undefined'

@slillo slillo closed this as completed Dec 14, 2016
@slillo slillo reopened this Dec 15, 2016
@slillo
Copy link
Author

slillo commented Dec 15, 2016

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

@uhlryk
Copy link
Owner

uhlryk commented Dec 15, 2016

Thx for your feedback. Usually new functionality introduce some border cases. I just fixed this one.

@uhlryk
Copy link
Owner

uhlryk commented Dec 15, 2016

THere is one issue with fixed option #41
Write what you think about 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