选中复选框后,我希望禁用整个类。
我有两个选项“升级现在”和“升级后”。
如果我稍后检查升级,我将获得时间选择器的选项来调度时间。
如果我现在检查升级,那么应该禁用时间表选择器。
我怎么才能禁用整个班级?
下面的代码用于复选框:
<div class="vcenter-domain-column">
<div class="checkbox vcenter-domain-chkboxbtn">
<input type="checkbox" id="vcenter-1" name="vcenter-1" value="1">
</div>
<!--<img class="vcenter-domain-pic" src="img/cloud-icon.png">-->
<div class="vcenter-domain-label">
<label for="vcenter-1">Upgrade Now</label>
</div>
</div>
<div class="vcenter-domain-column">
<div class="checkbox vcenter-domain-chkboxbtn checked">
<input type="checkbox" id="vcenter-2" name="vcenter-2" value="1">
</div>
<!--<img class="vcenter-domain-pic" src="img/cloud-icon.png">-->
<div class="vcenter-domain-label">
<label for="vcenter-2">Upgrade Later</label>
</div>
</div>下面的代码用于时间选择器:
<div class="update-schedule-section">
<p>Update schedule for all selected</p>
<div class="update-datepicker-section">
<div class="datepicker-box">
<span>date</span>
<input class="date-picker form-control" ng-click="open($event)" datepicker-popup="{{format}}" ng-model="dt" is-open="opened" min-date="minDate" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" type="text">
</div>
<div class="datepicker-box">
<span>Time</span>
<input class="time-picker" type="text" name="" value="10:00 PM">
</div>
<div class="datepicker-box">
<span>expected completion</span>
<span class="expected-date">Tuesday, Oct 7, 2014 - 2:00 AM</span>
</div>
</div>
</div>发布于 2015-02-19 09:35:40
请参考以下代码,
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-checkbox-input-directive-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.1/angular.min.js"></script>
</head>
<body ng-app="checkboxExample">
<script>
angular.module('checkboxExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.value1 = false;
$scope.value2 = false;
}]);
</script>
<form name="myForm" ng-controller="ExampleController">
Upgrade Now: <input type="checkbox" ng-model="value1"> <br/>
Upgrade Later: <input type="checkbox" ng-model="value2"> <br/>
<div ng-show="value2 && !value1">Time picker</div>
</form>
</body>
</html>这将为您提供适当的输出。
https://stackoverflow.com/questions/28602526
复制相似问题