0

我在查看页面上有一个复选框列表,用于发送不同角色的通知。我想最初禁用一些处于未选中状态的复选框。

我正在使用以下代码

<div ng-repeat="notification in NotificationList  | filter:{Media: item.Media}" ng-if="!collapsedNotification" ng-class="{'pad-top-4':($first)}" >
                                    <label for="NotificationLabel" class="col-sm-4 col-md-4 col-lg-4 control-label font-normal" title="{{notification.NotificationLabel}}">{{notification.NotificationLabel}}</label>
                            <div class="col-sm-1 col-md-1 col-lg-1"  style="line-height:35px;">
                                <span  class="col-lg-2 col-md-2 col-sm-2 item-padding ">
                                    <span class="default-pointer" ng-checkbox  ng-init="ToAdmin=false" ng-model='ToAdmin' ng-click="disableClick()" ng-disabled="ToAdmin"></input>

                                </span>

                            </div>
                            <div class="col-sm-1 col-md-1 col-lg-1" style="line-height:35px;">
                                <span  class="col-lg-2 col-md-2 col-sm-2 item-padding ">
                                    <span class="default-pointer" ng-checkbox ng-model='notification.ToNutritionist'></span>                                        
                                </span>
                            </div>
                            <div class="col-sm-1 col-md-1 col-lg-1"  style="line-height:35px;">
                                <span  class="col-lg-2 col-md-2 col-sm-2 item-padding ">
                                    <span class="default-pointer"  ng-checkbox ng-model='notification.ToPatient'></span>                                        
                                </span>
                            </div>
                                   </div>

如何使用 angularjs 禁用控制器中特定角色的复选框(处于未选中状态)?

4

1 回答 1

0

您可以使用该ng-disabled物业。

像这个例子:

<input type="checkbox" ng-click="disable=!disable">

<input type="checkbox" ng-disabled="disable">
于 2015-07-30T10:06:48.903 回答