File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/src/app/pipes/formatCurrency.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'formatCurrency',
})
export class FormatCurrencyPipe implements PipeTransform {
transform(amount: number, currency?: string): string {
currency = currency || 'COP';
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: currency,
currencyDisplay: 'narrowSymbol',
minimumFractionDigits: 0,
maximumFractionDigits: 2,
}).format(amount) + ' ' + currency;
}
}