ng generate pipe numberFormat --skip-import
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'numberFormat',
standalone: true,
})
export class NumberFormatPipe implements PipeTransform {
transform(value: string | number, args: string): string {
return value.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ',');
}
}
{{item.totalPrice | numberFormat : ''}}