【发布时间】:2018-02-02 12:45:15
【问题描述】:
我正在尝试在我的 Angular 4 应用程序中显示数字格式。基本上我正在看的是如果这个数字是 1223 万那么它应该显示例如 12.2M(小数点后一位)
如果数字是 50,000.123,那么 50.1K
我如何以角度实现这一点。我需要写指令吗?有角的内置管道吗?
结构
export interface NpvResults {
captiveInsYear: number[];
captiveInsPremiumPaid: number[];
captiveInsTaxDeduction: number[];
captiveInsLoanToParent: number[];
captiveInsCapitalContribution: number[];
captiveDividentDistribution: number[];
captiveInsTerminalValue: number[];
}
数组初始化为以下值
this.sourceResults.captiveInsPremiumPaid = [1,2,3,4,5];
html
<td *ngFor= "let item of NpvResults.captiveInsPremiumPaid" >{{item}}</td>
【问题讨论】:
标签: angular angular-pipe