当浏览器返回按钮用于导航到页面时,在 Chrome 上错误地应用了角度绑定



关于为什么会发生这种情况的任何想法?我有几个在 ngFor 中生成的文本框:

<tr *ngFor="let tableRow of lineItems; trackBy:trackByIndex; let rowIndex = index; ">     
<td class="psavingsSmallerGridCell"><input currencyMask [(ngModel)]="tableRow.existingCost" [attr.disabled] = "shouldExistingChargeBeReadOnly(tableRow)"/></td>
<td class="psavingsSmallerGridCell"><input currencyMask [(ngModel)]="tableRow.projectedCost" /></td>
<td class="psavingsSmallerGridCell"><input currencyMask [ngModel]="tableRow.actualCost" disabled /></td>

我已经 console.log 来验证模型中的 lineItems 数组是否准确,但无论出于何种原因,在 Chrome(版本 66.0.3359.181(官方内部版本(64 位(中使用后退按钮时,绑定到输入的值都会被各种抬高。在我尝试过的浏览器中,到目前为止只有Chrome具有这种行为。

混乱渲染的图像

我确实尝试删除 currencyMask 第三方指令以消除它作为问题的根源。

使用开发工具检查 DOM 显示混乱框中的 ng-reflect-model 属性分配了正确的值,只是输入文本值本身是错误的。

这最终与Angular关系不大,而与Chrome对动态表单的处理有关。在表单元素上设置自动完成=关闭解决了该问题。

相关内容

最新更新