试试这个
https://plnkr.co/edit/vYNhJI7yvlxKSBYWE13y?p=preview
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-checkbox-input-directive-production</title>
<script src="//code.angularjs.org/snapshot/angular.min.js"></script>
<style>
.question input[type='checkbox'] + label:after {
content:"-";
}
.question input[type='checkbox']:checked + label:after {
content:"+";
}
.question input[type='checkbox'] {
display:none;
}
label {
cursor:pointer;
}
</style>
</head>
<body ng-app="checkboxExample">
<script>
angular.module('checkboxExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.checkboxModel = {
value1 : true,
value2 : 'YES'
};
}]);
</script>
<form name="myform" ng-controller="ExampleController">
<ul>
<li class="question">
<input type="checkbox" name="question" id="question1" />
<label for="question1">Questions</label>
</li>
<li class="question">
<input type="checkbox" name="question" id="question2" />
<label for="question2">Questions</label>
</li>
</ul>
</form>
</body>
</html>
这与角无关,只是一个CSS问题 – charlietfl
那么。您可以简单地使用图标而不是复选框,并将值保存在局部变量上。 – Sagar