Skip to content

Conversation

yerdn
Copy link

@yerdn yerdn commented Sep 21, 2016

Added numFixed parameter to options (same as for filter).
Fixed bug with prepend and append symbols doubling on invalid input.
Don't default model to zero on invalid input so user can unset values.
Adding fractions part on blur event if numFixed="true".

Fixed bug with prepend and append symbols doubling on invalid input.
Don't default model to zero on invalid input so user can unset values.
Adding fractions part on blur event if numFixed="true".
@uhlryk
Copy link
Owner

uhlryk commented Sep 22, 2016

Thank you for your contribution!
At weekend I will review it. But at first glance It looks ok.

…ple entry of the prepend and append symbols in empty input.
@yerdn
Copy link
Author

yerdn commented Sep 26, 2016

Hello,

I have added few more fixes:
Keeping cursor on current position on invalid input. Preventing multiple entry of the prepend and append symbols in empty input.

Regards,
Andrey

@uhlryk
Copy link
Owner

uhlryk commented Sep 28, 2016

Hey
It need a little more time to approve it, because tests are failing. Im checking if there is a bug or if I should change tests.

@uhlryk
Copy link
Owner

uhlryk commented Oct 5, 2016

@yerdn can you explain how it should work. Maybe write here in comment how directive with this argument should look like. I ask because it isn't working for me:

I created directive :

<input type="text" ng-trim=false ng-model="someModel" awnum num-int=4 num-fract=4 num-fixed=true >

And when I type for example "1" I expect model equal 1.0000
I think I can't work because in version 2.0.0 model is always number. And number 1.0000 will be converted automatically to 1 .
If I type "1.12345" then I expect model to be equal "1.1234". And this works but it works because of num-fract=4

Maybe you can add working example (examples/index.html) or write test for it (test/directiveSpec.js) ?

@yerdn
Copy link
Author

yerdn commented Oct 6, 2016

Hi Krzysztof,

numFixed parameter should work the same way as numFixed option for filter. From your documentation "If true then there is fixed number of fraction digets - (useful when fraction part is 00 and we need to show this zeros e.g. 12,00 )". It should be the same behaviour, so it is a combiation of num-fract and num-fixed I suppose.

@uhlryk
Copy link
Owner

uhlryk commented Oct 6, 2016

But both of them has different output. Filter output is string and directive output is javascript number. Therefore in my opinion directive even if works with numFixed in output will change to number ( for example "1.00" will change to "1"). But I can be wrong, does it works for you? If yes please write working example code.

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

Successfully merging this pull request may close these issues.

2 participants