Skip to main content

NG2 Number format

import { Pipe } from '@angular/core';
import { DecimalPipe } from '@angular/common';

@Pipe({
  name: 'million'
})
export class MillionPipe extends DecimalPipe {
  transform(value: number): any {
    return super.transform(((value || 0)/ 1000000), "1.2-2");
  }
}

https://stackoverflow.com/questions/39642882/using-pipes-within-ngmodel-on-input-elements-in-angular

Comments