nbfontana / ngx-currency

Currency mask module for Angular 📦
https://nbfontana.github.io/ngx-currency
MIT License
237 stars 123 forks source link

[FEATURE] Change mask to be based on CurrencyPipe #14

Open ufoscout opened 6 years ago

ufoscout commented 6 years ago

Hi, first of all, thanks for this great library!

I am working on an internationalised application that supports multiple languages, locales and currencies. All the displayed currencies are formatted using the Angular CurrencyPipe ( https://angular.io/api/common/CurrencyPipe ), so we never specify what decimal separator needs to be used because the pipe picks the correct one for us based on the locale. Now want to use this library in our forms; however, we don't want to specify the decimal separator or currency symbol manually but we would like to have it inferred from the locale as well; is there a way to integrate it with the CurrencyPipe or make it work seamlessly?

ufoscout commented 6 years ago

It seems that angular already exports a function to format a currency based on the locale, it is used in the CurrencyPipe ( https://github.com/angular/angular/blob/master/packages/common/src/pipes/number_pipe.ts ):

formatCurrency(num, locale, currency, currencyCode, digitsInfo);

Maybe it can be reused.

elessariel commented 6 years ago

that is a very nice request indeed and we too could use that in a variety of our apps.

quedicesebas commented 5 years ago

Why this mask is not based on CurrencyPipe?

nbfontana commented 5 years ago

@sebrojas14 ngx-currency is based in an old angular module that didn't supported Mozilla at that time, and also had some issues. Since the owner didn't accept our help we created a new upgraded version of the legacy component.

The answer to your question is simple: nobody wanted to do yet.

I'm focused on other things, but anyone is free to suggest modifications, functionalities and code it itself.

quedicesebas commented 5 years ago

@nbfontana do you think is better to start a project from scratch?

BojanKogoj commented 4 years ago

Let's suppose someone would implement this. HOW do you implement it, without breaking for existing users? Would you need to add another option formatter with options of ANGULAR and CUSTOM where custom would be the default and remain a current implementation and ANGULAR would use CurrencyPipe?