首页 > 代码库 > angularJs中的checkboxs
angularJs中的checkboxs
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="http://www.mamicode.com/js/angular-1.3.0.js" ></script>
</head>
<body>
<div ng-app="hd" ng-controller="ctrl">
游戏:<input type="checkbox" ng-model="data.game" ng-true-value="http://www.mamicode.com/1" ng-false-value="http://www.mamicode.com/0"/>
电影:<input type="checkbox" ng-model="data.video" ng-true-value="http://www.mamicode.com/1" ng-false-value="http://www.mamicode.com/0"/>
{{data}}
<div ng-show="data.game == 1">游戏</div>
<div ng-show="data.video == 1">电影</div>
</div>
<script type="text/javascript">
var m = angular.module(‘hd‘,[]);
m.controller(‘ctrl‘,[‘$scope‘,function($scope){
$scope.data = http://www.mamicode.com/{game:0,video:0}
}]);
</script>
</body>
</html>
angularJs中的checkboxs