【发布时间】:2020-01-13 20:45:57
【问题描述】:
我已经尝试过了,如果我选中复选框,那么单选按钮也会被选中。当我选中复选框时,它会很好。
但是,如果我选择单选按钮绑定过程不会发生。即,如果我单击单选按钮,则必须选中复选框。
我不知道该怎么做?
这里放上代码。
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Learn It HTML Template</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
</head>
<body ng-app="sampleApp">
<div ng-controller="sampleController">
Are you going for party tonight: <input type="checkbox" ng-checked="checked" ng-model="checked">
<br/> <br/>
You should go, Complete this example and rest examples you can learn tomorrow :), So click on the check box above:
<br/> <br/>
<input id="checkSlave" type="radio" ng-checked="checked">Yeah :)
</div>
<script>
var app = angular.module("sampleApp", []);
app.controller('sampleController', ['$scope', function ($scope) {
$scope.checked= 0;
}]);
</script>
</body>
</html>
有人可以帮忙吗?
【问题讨论】:
标签: javascript html angularjs