有条件地在角度js中添加ng-checked属性

tot*_*eat 2 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'>
Run Code Online (Sandbox Code Playgroud)

属性:ng-checked ='checklast'

只有在某些条件成立的情况下,我该怎么做?

har*_*shr 8

只是一个例子

<input type="radio" ng-checked="testModel.child_1 && testModel.child_2" ng-model="isChecked"/>
Run Code Online (Sandbox Code Playgroud)

编辑

如果您使用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">
Run Code Online (Sandbox Code Playgroud)