如何解决此错误
错误:ExpressionChangedAfterItHasBeenCheckedError:检查表达式后,表达式已更改。先前的值:'model:dsadasd'。当前值:“型号:”。
我正在用英语运行这段代码
当我执行下一个视图并且单击按钮添加新行时,我会发生此错误
这将是我的html代码
<div class="col-md-12" *ngIf="this.param != 'new'">
<div class="row" [formGroup]="formularioEscala">
<div class="col-md-6">
<div class="form-group">
<label for="concepto_valor">Nombre de la Escala</label>
</div>
</div>
<div class="col-md-3">
<div class="form-group" style="text-align: center;">
<label for="nivel">Nivel</label>
</div>
</div>
<ng-container *ngFor="let esca of escala_inicial; let i = index">
<div class="col-md-7">
<div class="form-group">
<input [(ngModel)]="esca.concepto_valor" class="form-control" type="text" id="concepto_valor_{{ i }}"
[value]="" formControlName="concepto_valor">
</div>
</div>
<div class="col-md-1">
<div class="form-group" style="text-align: center;">
<label for="nivel" id="nivel_{{ i }}">{{esca.nivel}}</label>
</div>
</div>
</ng-container>
</div>
</div>
<button type="button" class="btn btn-dark" (click)="addRango()" id="del_{{ i }}"><i class="mdi mdi-plus-circle"></i> Agregar</button>
这是我的代码.ts
this.escala_inicial =
[
{
"concepto_valor": "",
"nivel": "0"
},
{
"concepto_valor": "",
"nivel": "1"
}
];
addRango() {
let indexTipo = this.escala_inicial.length;
let newConfig: any = {
concepto_valor: '',
nivel: indexTipo
};
this.escala_inicial.push( newConfig );
}
请帮助我!