输入控件在ng-repeat下的tfoot中被禁用

时间:2016-03-06 16:28:20

标签: javascript angularjs typescript handlebars.js

JSON返回超过3种类型的学生详细信息,并且每个学生成功创建一个表,但是对于一个类型合作伙伴的学生,三个应该有一些输入控件,如复选框和按钮可用。面临的问题是复选框显示但控件已禁用

这是我试过的

                                                                                                                                                   {{i.memberType | fcap}}成员 - {{i.name.first}} {{i.name.last}}                                                                            

               <tfoot ng-show="i.memberType == 'PARTNER'">
               <tr>
                    <td>
                        <input type="checkbox" id="iautho" ng-model="iautho" ng-checked="ctrl.isAuthorized">
                        <label for="iautho">I authorize this member to view and update student information.</label>

                <input type="checkbox" id="ihave" ng-model="ihave" ng-checked="ctrl.isAuthorized">
                <label for="ihave" ng-show="iautho">I have read, understand and voluntarily agree to all the terms and conditions of the
                <a href="#" ng-click="navigate('global.account.agreements',{agreementId:9}, true)">Partner Access Authorization agreement.</a></label>

                <button id="studentdetails" type="submit" class="btn btn-primary" ng-disabled="!ihave">Update
                </button>
                </td></tr>
                <hr class="m-y-1">
               </tfoot> 

我可以知道我做错了什么吗?

1 个答案:

答案 0 :(得分:0)

  

我面临的问题是复选框显示但控件已禁用

您同时拥有ng-modelng-checked。您不应该使用ng-checked因为ng-model就足够了。

简单示例:http://jsfiddle.net/Lvc0u55v/736/

var myApp = angular.module('myApp',[]);

function MyCtrl($scope) {
    $scope.foo = true;
}


<div ng-controller="MyCtrl">
  <input type="checkbox" ng-model="foo"/>
</div>