Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 在angular js中有条件地添加ng checked属性_Angularjs - Fatal编程技术网

Angularjs 在angular js中有条件地添加ng checked属性

Angularjs 在angular js中有条件地添加ng checked属性,angularjs,Angularjs,我想补充以下内容: <input type="radio" ng-name='{{quest.id}}' ng-model='$parent.$parent.choice.input' ng-value='{{option}}' id='{{quest.id}}-{{option.id}}' ng-required='required'> 属性:ng checked='checklast' 只有当某个条件为真时,我才能这样做。只是一个例子 <input type="r

我想补充以下内容:

<input  type="radio" ng-name='{{quest.id}}' ng-model='$parent.$parent.choice.input'  ng-value='{{option}}' id='{{quest.id}}-{{option.id}}' ng-required='required'>

属性:ng checked='checklast'

只有当某个条件为真时,我才能这样做。

只是一个例子

<input type="radio" ng-checked="testModel.child_1 && testModel.child_2" ng-model="isChecked"/>

编辑

如果使用ng repeat显示收音机列表,则

<input  type="radio" ng-name='{{quest.id}}' ng-model='$parent.$parent.choice.input'  ng-value='{{option}}' id='{{quest.id}}-{{option.id}}' ng-required='required' ng-checked="$index == $last">


不,我的意思是我想要这样的东西:条件是什么?为什么不把条件放在
ng checked
本身中呢?