我有一个像 54781.7622000 、 1123.11 这样的值。我希望这个值的格式为 $54781.76 , $1123.11 。
//import currency pipe
import { CurrencyPipe } from '@angular/common'
//initialize in constructor
constructor(private cp: CurrencyPipe)
this.formatedOutputValue = this.cp.transform(parseInt(this.outputValue));
Run Code Online (Sandbox Code Playgroud)
我已经尝试过在这个值之后对额外的参数进行求和。
this.formatedOutputValue = this.cp.transform(parseInt(this.outputValue),1.2-2);
Run Code Online (Sandbox Code Playgroud)
但是不锻炼。