feat(common): allow default currency code to be configurable (#34771)
Default currency code in CurrencyPipe is currently hardcoded to USD and is not configurable. This commit allows the default currency code to be configurable by adding a DEFAULT_CURRENCY_CODE injection token. Example: ``` providers: [{ provide: DEFAULT_CURRENCY_CODE, useValue: "GBP" }] ... {{ 123.45 | currency }} // outputs £123.45 as opposed to always $123.45 before ``` Closes: #25461 PR Close #34771
This commit is contained in:
2
tools/public_api_guard/common/common.d.ts
vendored
2
tools/public_api_guard/common/common.d.ts
vendored
@ -13,7 +13,7 @@ export declare class CommonModule {
|
||||
}
|
||||
|
||||
export declare class CurrencyPipe implements PipeTransform {
|
||||
constructor(_locale: string);
|
||||
constructor(_locale: string, _defaultCurrencyCode?: string);
|
||||
transform(value: any, currencyCode?: string, display?: 'code' | 'symbol' | 'symbol-narrow' | string | boolean, digitsInfo?: string, locale?: string): string | null;
|
||||
}
|
||||
|
||||
|
2
tools/public_api_guard/core/core.d.ts
vendored
2
tools/public_api_guard/core/core.d.ts
vendored
@ -257,6 +257,8 @@ export declare const DebugNode: {
|
||||
new (...args: any[]): DebugNode;
|
||||
};
|
||||
|
||||
export declare const DEFAULT_CURRENCY_CODE: InjectionToken<string>;
|
||||
|
||||
/** @deprecated */
|
||||
export declare class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChanges<V> {
|
||||
readonly collection: V[] | Iterable<V> | null;
|
||||
|
Reference in New Issue
Block a user