码迷,mamicode.com
首页 > 其他好文 > 详细

angular笔记_3

时间:2017-12-20 04:02:11      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:option   value   show   set   false   sel   .com   doc   doctype   

<!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>

angular笔记_3

标签:option   value   show   set   false   sel   .com   doc   doctype   

原文地址:http://www.cnblogs.com/yewook/p/8067644.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!