ng-click和ng-change都没有调用CHECKBOX的功能

时间:2016-08-20 15:12:29

标签: angularjs

<div id="funds">
    <table border="0" style="width:100%;">
        <tbody>
            <tr ng-repeat="parent in vm.fundList">
                <td align="left" valign="top" colspan="6">
                    <span style="display:inline-block;background-color:#EBEBEB;font-family:Verdana;font-size:8pt;font-weight:bold;width:100%;">
                        <input ng-model="parent.ParentID" id='parent.ParentID' ng-click="vm.SelectAllFunds(parent.ParentID)" type="checkbox" >
                        <label>{{parent.ParentFundName}}</label>
                    </span>
                </td>



                <td align="left" valign="top">
                    <span style="display:inline-block;font-family:Verdana;font-size:8pt;width:100%;">
                        <input id="child + parent.ChildFund.ChildID" type="checkbox" value=" parent.ChildFund.ChildFundName" name=" parent.ChildFund.ChildFundName" ng-click="vm.checkFund(parent.ChildFund.ChildID)">
                        <label>{{parent.ChildFund.ChildFundName}} </label>
                    </span>
                </td>

            </tr>
        </tbody>
        </table>

</div>

ng-click和ng-change尝试了两者,但两者都不适用于使用ng-repeat动态生成的复选框。

1 个答案:

答案 0 :(得分:0)

你可以尝试像这样检查:

<INPUT
    ng-checked="expression">
    ...
</INPUT>

https://docs.angularjs.org/api/ng/directive/ngChecked