-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Description
🚀 feature request
Relevant Package
@angular/common
Description
With current implementation, developers have to mannually specify the DEFAULT_CURRENCY_CODE, if they use a different locale rather than en-us and want to use the currency meta along with that locale.
here is how currency pipe implements:
angular/packages/common/src/pipes/number_pipe.ts
Lines 205 to 208 in c49b280
| export class CurrencyPipe implements PipeTransform { | |
| constructor( | |
| @Inject(LOCALE_ID) private _locale: string, | |
| @Inject(DEFAULT_CURRENCY_CODE) private _defaultCurrencyCode: string = 'USD') {} |
In fact, there is a function to get currency code from a target locale
| export function getLocaleCurrencyCode(locale: string): string|null { |
I believe using the currency code from specified locale is the right way to go, rather than specifying it mannually.
Describe the solution you'd like
deprecate the use of DEFAULT_CURRENCY_CODE, in favor of getLocaleCurrencyCode in currency pipe.
Describe alternatives you've considered
There are always the alternatives, but not the elegant way.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels