So I am trying to implement currency format on an input field. The input field will have the same behavior as the currency pipe (2 decimal points). is this possible in angular 13? Thanks in advance!
So I am trying to implement currency format on an input field. The input field will have the same behavior as the currency pipe (2 decimal points). is this possible in angular 13? Thanks in advance!
Yes that's possible. The native approach (you doing it yourself) might be cumbersome (and potentially, buggy). Maybe there is a better approach.
To the extent of my knowledge there is a library called ng-mask by Netanel Basal that helps you transform the input field value to the desired format (currencies, licence plates, and emails, etc). It has the following:
Support for form validation
Wrapper function to easily create input-masks
Helps you to convert final values to desired format
☝️ Single directive to handle everything
All the configurations of inputmask provided
Check the repository on Github and follow the steps to use it after installation.
Here is the directive in action: