我通过[ngValue]="operator.value"
时工作正常。当我将ngValue
更改为"operator"
时,错误会更改为
"试图区分' [对象]'"
我正在尝试发布完整数组而不是值。
HTML代码:
<select class="form-control" formControlName="operators" (change)="onChangeOfUdfParamValue(i,operators)">
<option [ngValue]="opera" *ngFor="let opera of formula.controls.operators.value" [attr.selected]="opera.selected ? true : null" >
{{opera.display}}
</option>
</select>
JSON格式:
"operators": [
{
"display": "=",
"value": ">",
"active": true,
"selected": false
},
{
"display": ">",
"value": ">",
"active": true,
"selected": false
},
{
"display": "<",
"value": "<",
"active": true,
"selected": false
}
]
答案 0 :(得分:0)
错误原因:
对象数组已转换为对象
两种解决方法:
解决方案1: Change object to new formArray().
解决方案2: change formcontrolName to other name which will create new formcontrol().