AngularJS的指令
来源:互联网 发布:windows怎么装显卡驱动 编辑:程序博客网 时间:2024/06/06 20:54
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>选项卡</title>
<style>
* {
margin: 0;
padding: 0;
}
/*标题 列表 */
#btn_group {
list-style: none;
margin: 0 auto;
width: 850px;
}
#btn_group li {
width: 200px;
height: 40px;
line-height: 40px;
border: 1px solid black;
float: left;
margin: 5px;
text-align: center;
}
#content {
width: 800px;
height: 400px;
border: 1px solid black;
overflow: hidden;
clear: both;
margin: 0 auto;
position: relative;
}
#content div {
position: absolute;
top: 0;
left: 0;
}
.btn_in {
background: blue;
}
.selected {
background-color: lightgreen;
}
.hide {
display: none;
}
.show {
display: block;
}
</style>
<script src="lib/angular.min.js" ></script>
<script>
var myapp= angular.module("myApp",[]);
myapp.controller("myCtr",["$scope",function($scope){
$scope.xz=0;
$scope.lists=["韦作铭","罗兵","伊喜龙","谢帅康"];
$scope.show=function(i){
$scope.xz=i;
}
$scope.stus=[{name:'罗兵',age:23,sex:"男"},{name:'伊喜龙',age:22,sex:"男"},{name:'谢帅康',age:21,sex:"男"}];
}]);
</script>
</head>
<body ng-controller="myCtr">
<ul id="btn_group">
<li ng-repeat="title in lists" ng-class="{selected: $index==xz }" ng-click="show($index)">
{{title}}
</li>
</ul>
<br />
<br />
<br />
<br />
<div align="center" ng-app="">
<ul>
<li ng-show="1">当值为true时显示,false不显示</li>
<li ng-hide="0">当值为true时隐藏,false显示</li>
<li ng-show="1">+++++++++++++++++++</li>
<li ng-show="xz==0">韦作铭</li>
<li ng-show="xz==1">罗兵</li>
<li ng-show="xz==2">伊喜龙</li>
<li ng-show="xz==3">谢帅康</li>
<li ng-show="1">+++++++++++++++++++++</li>
</ul>
</div>
<div align="center" ng-controller="myCtr">
<ul>
<li ng-repeat="a in lists">{{$index}} {{a}}</li>
</ul>
人员信息
<ul ng-init="dogs=[{name:'韦作铭',age:23}]">
<li ng-repeat="stu in dogs">
编号:{{$index}} 姓名:{{stu.name}}年龄:<span ng-bind="stu.age"></span>
</li>
</ul>
组员列表
<ul>
<li ng-repeat="stu in stus">
编号:{{$index+1}} 姓名:{{stu.name}}年龄:{{stu.age}}
</li>
</ul>
</div>
</body>
</html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>选项卡</title>
<style>
* {
margin: 0;
padding: 0;
}
/*标题 列表 */
#btn_group {
list-style: none;
margin: 0 auto;
width: 850px;
}
#btn_group li {
width: 200px;
height: 40px;
line-height: 40px;
border: 1px solid black;
float: left;
margin: 5px;
text-align: center;
}
#content {
width: 800px;
height: 400px;
border: 1px solid black;
overflow: hidden;
clear: both;
margin: 0 auto;
position: relative;
}
#content div {
position: absolute;
top: 0;
left: 0;
}
.btn_in {
background: blue;
}
.selected {
background-color: lightgreen;
}
.hide {
display: none;
}
.show {
display: block;
}
</style>
<script src="lib/angular.min.js" ></script>
<script>
var myapp= angular.module("myApp",[]);
myapp.controller("myCtr",["$scope",function($scope){
$scope.xz=0;
$scope.lists=["韦作铭","罗兵","伊喜龙","谢帅康"];
$scope.show=function(i){
$scope.xz=i;
}
$scope.stus=[{name:'罗兵',age:23,sex:"男"},{name:'伊喜龙',age:22,sex:"男"},{name:'谢帅康',age:21,sex:"男"}];
}]);
</script>
</head>
<body ng-controller="myCtr">
<ul id="btn_group">
<li ng-repeat="title in lists" ng-class="{selected: $index==xz }" ng-click="show($index)">
{{title}}
</li>
</ul>
<br />
<br />
<br />
<br />
<div align="center" ng-app="">
<ul>
<li ng-show="1">当值为true时显示,false不显示</li>
<li ng-hide="0">当值为true时隐藏,false显示</li>
<li ng-show="1">+++++++++++++++++++</li>
<li ng-show="xz==0">韦作铭</li>
<li ng-show="xz==1">罗兵</li>
<li ng-show="xz==2">伊喜龙</li>
<li ng-show="xz==3">谢帅康</li>
<li ng-show="1">+++++++++++++++++++++</li>
</ul>
</div>
<div align="center" ng-controller="myCtr">
<ul>
<li ng-repeat="a in lists">{{$index}} {{a}}</li>
</ul>
人员信息
<ul ng-init="dogs=[{name:'韦作铭',age:23}]">
<li ng-repeat="stu in dogs">
编号:{{$index}} 姓名:{{stu.name}}年龄:<span ng-bind="stu.age"></span>
</li>
</ul>
组员列表
<ul>
<li ng-repeat="stu in stus">
编号:{{$index+1}} 姓名:{{stu.name}}年龄:{{stu.age}}
</li>
</ul>
</div>
</body>
</html>
阅读全文
0 0
- AngularJs 的指令
- angularjs指令的使用
- AngularJS 风谲云诡的指令
- AngularJS 大雅之堂的指令
- angularjs的指令详解
- AngularJS 内置的指令
- 理解Angularjs的指令
- AngularJS的指令
- AngularJS的常见指令
- AngularJS的指令
- angularjs指令的&=@<?
- 《AngularJS》--指令的相互调用
- AngularJS 优雅的自定义指令
- Angularjs 几个指令的坑
- angularjs自定义指令的用法
- angularjs一些简单的指令
- 论angularjs指令的重要性
- angularjs 自定义指令的分类
- 利用anaconda同时使用python2和python3的方法
- html写简单网页
- FTP服务器工作原理及如何通过PAM认证实现虚拟用户登录
- numpy tile 和 matlab repmat
- import
- AngularJS的指令
- Hadoop 安装完之后,做一个简单的测试
- Android基本架构
- 十一周-窗口程序浏览器
- sql2008备份集中的数据库备份与现有的xxx数据库不同解决方法
- 前端面试题之布局
- android报Error:No resource identifier found for attribute 'roundIcon' in package 'android'错误解决方法
- 阿里云2017双十一狂欢盛宴倒计时,你准备好了吗
- hdu 1789 How many ways(记忆化搜索)