0
我想在formly onBlur事件上执行一些计算,之后想要隐藏并显示下一个单选按钮字段。角形formly onblur计算和隐藏/显示字段错误
当我调试一切看起来不错,但在用户界面我无法看到正确的行为。
首先是文本输入,第二个字段是收音机,我也想动态设置标签。
我错过了什么吗?任何其他方式来设置?
fields [
{
"type": "moneyInput",
"key": "amtRcv",
"id" : "amtRcv",
"templateOptions": {
required: true,
label:"",
onBlur: function calcAmount($viewValue, $modelValue, scope) {
var recvAmt = $viewValue;
if(recvAmt)
{
var missingAmount = service.amnt - recvAmt;
//here trying to set the hide and label for radio field. It is getting set but not working as expected
fields[1].hideExpression = "false";
fields[1].templateOptions.label = 'So, is $' + missingAmount + ' is missing? ';
} else {
fiedls[1].hideExpression = "true";
}
}
}
},
{
"type": "radioInput",
"key": "amnt",
"id" : "amnt",
"wrapper" : "requiredField",
"templateOptions": {
required: true,
label:"",
"options": [
{
"name": "Yes",
"value": true
},
{
"name": "No",
"value": false
}
]
}
}
]
最好先修改代码缩进 – blackmiaool
对不起,已更正。 – user2836364