是否可以使用AngularJs:master复选框打开/关闭子复选框 - 每个复选框显示不同的内容。 Plunker #1st try
noCommas <- gsub("([0-9]+)\\,([0-9])", "\\1\\2", withCommas)
#2nd try
noCommas <- gsub(",", "", withCommas)
答案 0 :(得分:0)
是的,您可以创建一个主复选框切换。 Here's a working plunkr
查看强>
<input type="checkbox" ng-model="selectAll" ng-click="checkAll()" />
<input type="checkbox" ng-model="checkbox[0].selected" />
<input type="checkbox" ng-model="checkbox[1].selected" />
<input type="checkbox" ng-model="checkbox[2].selected" />
<强>控制器强>
// Check/uncheck all boxes
$scope.checkAll = function () {
angular.forEach($scope.checkbox, function (obj) {
obj.selected = $scope.selectAll;
});
};
答案 1 :(得分:0)
将模型添加到&#39; ng-checked&#39;表达
<input id="checkSlave" type="checkbox" ng-checked="master || slave1" ng-model="slave1" aria-label="Slave input">
<input id="checkSlave" type="checkbox" ng-checked="master || slave2" ng-model="slave2" aria-label="Slave input">
<input id="checkSlave" type="checkbox" ng-checked="master || slave3" ng-model="slave3" aria-label="Slave input">
添加&#39; master&#39;进入ng-show表达式
<div ng-show="slave1 || master">Slave one showed!</div>
<div ng-show="slave2 || master">Slave two showed!</div>
<div ng-show="slave3 || master">Slave three showed!</div>