【发布时间】:2017-09-30 18:32:44
【问题描述】:
我有一个像
这样的嵌套数组permission": [
{
"id": 2,
"key": "creatBusinessPermission",
"legend": "BusinessModule",
"ischecked": false,
"label": " Create Business Settings",
"roles": [
{
"id": 1,
"key": "self",
"ischecked": false
},
{
"id": 2,
"key": "selfrole",
"ischecked": false
},
{
"id": 3,
"key": "other",
"ischecked": false
},
{
"id": 4,
"key": "All",
"ischecked": false
}
]
},
{
"id": 3,
"key": "editBusinessPermission",
"legend": "BusinessModule",
"ischecked": true,
"label": " Edit Business Settings",
"roles": [
{
"id": 1,
"key": "self",
"ischecked": false
},
{
"id": 2,
"key": "selfrole",
"ischecked": false
},
{
"id": 3,
"key": "other",
"ischecked": false
},
{
"id": 4,
"key": "All",
"ischecked": false
}
]
}]
对于上述数组,我使用的是反应形式, 构建表单后,我有一个函数用于 onchange 权限,当调用该函数时,权限相关的 ischecked 和 self ischecked 更改为 true,我完成的权限被检查为真正完美, 我正在努力做的是 ** self ** ischecked as true,
这是我的代码
(<FormArray>this.roleForm.controls['permission']).at(index).patchValue({
ischecked : true
}) This is works fine
我不知道该做什么
(<FormArray>this.roleForm.controls['permission']).at(index).get('roles').at(1)..patchValue({
ischecked : true
}) this code giving error, Probebly I did n't no how to do
【问题讨论】:
-
'..' 是实际的错字还是有问题的错字?
-
这是我项目中的一个场景
标签: angular angular2-routing angular2-forms angular2-directives