angular - 掩码中的值不正确 Angular
问题描述
我有以下库 https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html
我创建了这个指令
我的 TS
initForm() {
this.form = this.fb.group({
item_number: [this.service.lpu.item_number, Validators.required],
material: [this.service.lpu.material, Validators.required],
description: [this.service.lpu.description, Validators.required],
unit: [this.service.lpu.unit, Validators.required],
net_value: ['', Validators.required],
gross_amount: ['', Validators.required],
lpu_type: [this.service.lpu.lpu_type, Validators.required],
});
}
和我的看法
<div fxFlex="35" fxFill fxLayoutAlign="start center">
<mat-form-field>
<mat-label>Valor Bruto</mat-label>
<input matInput formControlName="gross_amount" money>
</mat-form-field>
</div>
<div fxFlex></div>
<div fxFlex="35" fxFill fxLayoutAlign="start center">
<mat-form-field>
<mat-label>Valor Líquido</mat-label>
<input matInput formControlName="net_value" money>
</mat-form-field>
</div>
我不知道为什么结果是这样的“1,550”和“55,000”我需要结果来链接这个“15,00”和“550,00”任何想法?
解决方案
我认为口罩不能正常工作。库存储库中的示例可能会更好,它没有显示此特定掩码的预期结果。
mask("#.##0,00", {reverse: true}); // maybe wrong?!
你试过他的第一个金钱面具例子吗?
mask('000.000.000.000.000,00', {reverse: true});
我建议在掩码定义中尝试不同的模式,因为问题可能就在那里
推荐阅读
- sql - SQL Server DATEDIFF 对 YEAR 差值进行四舍五入。如何四舍五入?
- javascript - Javascript 对象,返回包含嵌套数组中的值的更新对象
- r - grDevices::dev.new() 第一次不起作用
- vue.js - 带有 imagemin webpack 插件的 Vue cli 3
- sql - 大于或小于一个数量
- ms-access - 通过访问表单上的按钮将费用记录复制到发票详细信息
- java - Spring Integration 从 REST 服务获取分页结果
- javascript - 查找最大匹配计数
- r - 使用 ggplot scale_x_yearmon 缺少 yearmon 标签
- sql - SSIS 中的 Google Analytics/Adwords 数据?