2
import { Pipe, PipeTransform  } from '@angular/core';
import { DecimalPipe, PercentPipe, CurrencyPipe } from '@angular/common';

class myClass{
   formattedData( value:string){
      let  moneyPipe = new CurrencyPipe();
      moneyPipe.transform( value, 'USD', true );
   }
}

I got error of "Supplied parameters do not match any signature of call target" for the line new CurrencyPipe();

Is there a way to apply build-in pipe programmatically? What's wrong with the code above ?

Thanks.

Jane
  • 159
  • 2
  • 10
  • 3
    Seems you need to provide locale. Check this http://stackoverflow.com/questions/39607568/cannot-instantiate-datepipe See also example https://plnkr.co/edit/pYf6PNiKLErWzuUBho86?p=preview – yurzui Feb 16 '17 at 19:31

0 Answers0