angular笔记_3

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>

单选按钮
<div ng-app="hd" ng-controller="ctrl">
<input type="radio" ng-model="status" ng-value="1"/>开启
<input type="radio" ng-model="status" ng-value="0"/>关闭

<dvi ng-show="status==0">
正在维修中...
</dvi>

<br/><br/><br/><br/>

复选框
{{data}}
电影:<input type="checkbox" ng-model="data.game" ng-true-value="1" ng-false-value="0"/>
游戏:<input type="checkbox" ng-model="data.video" ng-true-value="1" ng-false-value="0"/>
<div ng-show="data.game==1">
<h1>电影爱好</h1>
</div>
<div ng-show="data.video==1">
<h1>游戏爱好</h1>
</div>
<br/><br/><br/><br/>
{{block}}

下拉列表
<select ng-options="v.value as v.name for v in city" ng-model="block"></select>
</div>
<script>
var m=angular.module('hd',[]);
m.controller('ctrl',['$scope',function($scope){
$scope.status=1;
$scope.data={game:0,video:0};

$scope.block='yongan'
$scope.city=[
{'name':'厦门','value':'xiamen'},
{'name':'泉州','value':'quanzhou'},
{'name':'永安','value':'yongan'},
];
}]);
</script>
</body>
</html>

posted @ 2017-12-19 20:42  yewook  阅读(86)  评论(0编辑  收藏  举报