我想要一个示例,其中我有一个下拉菜单和复选框。复选框的字段必须与下拉列表中的数据相同。
现在当我在下拉列表中选择一个值时,它应勾选/取消选中复选框列表中的相应选项
答案 0 :(得分:0)
<div ng-app="myApp" ng-controller="myCtrl">
<select ng-model="selected">
<option ng-repeat="x in names">{{x}}</option>
</select>
<br>
<input type="radio" ng-model="selected" value="ABC">ABC<br>
<input type="radio" ng-model="selected" value="DEF">DEF<br>
<input type="radio" ng-model="selected" value="GHI">GHI<br>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.names = ["ABC", "DEF", "GHI"];
});
</script>