嗨,我正在使用以下代码在发生模糊事件时将用户输入转换为货币格式:
<input type="text" placeholder="Test Price" [ngModel]="testPrice | currency:'USD':'symbol':'2.2'" [ngModelOptions]="{updateOn:'blur'standalone: true}"
(ngModelChange)="testPrice=$event"/>
以上这段代码对我来说很好用,但是只要我将formControlName包括为:
<input maxlength= 15 class="form-control" id="textid" formControlName="testInput" [ngModel]="testModel| currency:'USD':'symbol':'2.2' " (ngModelChange)="testModel=$event" [ngModelOptions]="{updateOn:'blur',standalone: true}"/>
它抛出以下错误
Can't bind to 'ngModelOptions' since it isn't a known property of 'input'. ("ol" id="FeePolicyAmt" formControlName="asdsd" [ngModel]="testPrice | currency:'USD':'symbol':'2.2'" [ERROR ->][ngModelOptions]="{updateOn:'blur',standalone: true}"
我确保我已在module.ts中包含表单,并且formControlName也已正确定义