我试图显示两个数字的总和,但它返回额外的零。
样本
newprice -> 174.000
added number -> 1
total should be -> 174.001
but it shows 1.740.001
代码
view
{{(newprice + optionPrice | currency: 'Rp ' : 'symbol' : '1.0-0')}}
controller
export class OptionsPage implements OnInit {
optionPrice = '0';
newprice: null;
constructor(
public modalController: ModalController
) { }
ngOnInit() {
this.newprice; // it comes from other page in this case is (174000)
this.optionPrice;
}
// this price comes from selected option and will be sum to "newprice" value (in this sample is 1)
onChange(value) {
console.log(value);
this.optionPrice = value;
}
}
任何想法?