0

On an input number field when the user starts typing I want to have the field automatically convert it to currency with cents first.

For example, if I input 1, it will show .01 in the input box.

If I input 1234 it will show 12.34 in the field. While I am typing it will start showing .01, then .12, then 1.23, then finally 12.34 when I am finished.

I believe Paypal does something similar to this on their site when a user is transferring balances.

1 Answer 1

1

You can get this functionality by using the ngx-currency package. Visit https://www.npmjs.com/package/ngx-currency to find more information.

I currently use this on a project and it has saved me many headaches from trying to self-program currency logic.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, after doing more research this is about what I came up with as well. Discovered very quickly that I was going to need a package to use or spend several days writing up and testing a new solution for it. I was hoping there was simple way that was already built in or a method - but guess not! :) Thanks for assurance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.