遮罩中的值不正确角度

时间:2020-11-06 02:21:59

标签: angular mask

我有以下图书馆 https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html

我创建了该指令

enter image description here

我的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>

在控制台中,我得到这个结果 enter image description here

我不知道为什么结果会像这样的“ 1,550”和“ 55,000” 我需要将结果链接到此“ 15,00”和“ 550,00” 有任何想法吗?

1 个答案:

答案 0 :(得分:0)

我认为面罩无法正常工作。库存储库中的示例可能会更好,它没有显示此特定掩码的预期结果。

mask("#.##0,00", {reverse: true}); // maybe wrong?!

您尝试过他的第一个防毒面具示例吗?

mask('000.000.000.000.000,00', {reverse: true});

我建议在掩码定义处尝试不同的模式,因为可能存在问题