我有以下HTML代码,但遇到了异常。如何修复?
解析错误:在表达式预期位置的列48处获取了插值({{}}) [!(editForm.controls.field_item_exportExpression_{{i}}?.dirty && editForm.controls.field_item_exportExpression_{{i}}?.invalid)]
<div class="form-group">
<label class="form-control-label" for="field_exportExpression">exportExpression</label>
<input class="form-control" type="text" id="field_item_exportExpression_{{i}}" name="item_exportExpression_{{i}}" [(ngModel)]="datatype.items[i].exportExpression" required>
<div [hidden]="!(editForm.controls.field_item_exportExpression_{{i}}?.dirty && editForm.controls.field_item_exportExpression_{{i}}?.invalid)">
<small class="form-text text-danger" [hidden]="!editForm.controls.field_item_exportExpression_{{i}}?.errors?.required" dpTranslate="dataconfiguration.validation.required"> This field is
required. </small>
</div>
</div>
以下内容无法工作。显示出现了不想要的标记[
。
[hidden]="!editForm.controls.['item_exportExpression_' + i]?.errors?.required
以下内容不是抱怨 [
,而是抱怨 Cannot read property '0' of undefined
。 [hidden]="!editForm.controls.item_exportExpression_[ i]?.errors?.required