码迷,mamicode.com
首页 > Web开发 > 详细

AngularJs 学习 笔记 3

时间:2015-03-31 14:18:58      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

<script id="others_angular_103" type="text/javascript" class="library" src="/js/sandbox/other/angular.min.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<html> 
		<script class="library" src="/js/sandbox/other/angular-1.3.0.js" ></script>

<style>
table, th , td  {
  border: 1px solid grey;
  border-collapse: collapse;
  padding: 5px;
}
table tr:nth-child(odd)	{
  background-color: #f1f1f1;
}
table tr:nth-child(even) {
  background-color: #ffffff;
}
</style>
<body>
<!--
<div ng-app="" ng-init="names=[
{name:‘Jani‘,country:‘Norway‘},
{name:‘Hege‘,country:‘Sweden‘},
{name:‘Kai‘,country:‘Denmark‘}]">
<p>循环对象:</p>
<ul>
  <li ng-repeat="x in names">
  {{ x.name + ‘, ‘ + x.country }}</li>
</ul>
</div>-->
<!--	<div ng-app="" ng-controller ="test0Ctrl">
		{{ test.name +" is "+test.age +" years old. " }}
		<br />
		{{ test.job()}}  
		<br />
		{{ test.name+" always "+lunch() +" have lunch."}}
	</div>-->
	<div ng-app="" ng-controller ="newController">
	 <ul>
		 <!--orderBy 过滤器 -->
		 <li ng-repeat="i in LontonCP | orderBy: ‘addr‘">
			 {{"The name is : "+i.name+" sex is : "+i.sex +" and the home address is in "+i.addr}}
			 <p>姓名转为小写为 {{ i.name | lowercase  }}</p>
		 </li>
		</ul>
		<input type = "text" ng-modal ="say.text" />
		<p>{{say.text}},Angular.js</p>
	<table>
		<th>姓名</th>
		<th>性别</th><th>家庭住址</th>
		<tr ng-repeat="j in LontonCP | orderBy: ‘addr‘">
			<td>{{j.name}}</td>
			<td>{{j.sex}}</td>
			<td>{{j.addr}}</td>
		</tr>
	</table>
	</div>
<!--
	<div ng-app="" ng-init="test=[
{age:10,sex:‘M‘},
{age:11,sex:‘F‘},
{age:12,sex:‘F‘}]">
		<p>循环数据</p>
		<ul>
			<li ng-repeat="y in test">
				{{ y.age +" is : " + y.sex}}
			</li>
		</ul>
	</div>
-->
<script src="//www.w3cschool.cc/try/angularjs/1.2.5/angular.min.js"></script>
	
</body>
</html>

  

 

function test0Ctrl ($scope){
		$scope.test = {
			name:"ton",
			age:33,
			time:‘12:20‘,
			job:function(){
			
				var obj = $scope.test;
				
				return "he work in Big ";
			}
			
		};

		
		$scope.lunch = function(){
		
			return $scope.test.time;
		};
		
	}
function newController ($scope){

	$scope.LontonCP =[
		{name:"WenFeng",sex:"M",addr:"武汉"},
		{name:"WangHongJun",sex:"M",addr:"江苏"},
		{name:"TianHaoYuan",sex:"M",addr:"宝鸡"},
		{name:"LiuFang",sex:"F",addr:"黑龙江"},
		{name:"ZhuJun",sex:"M",addr:"江苏"},
		{name:"WangRenSen",sex:"M",addr:"厦门"},
		{name:"YangMing",sex:"F",addr:"咸阳"},
		{name:"SiDang",sex:"M",addr:"临潼"}
		
	]
		
}

  

AngularJs 学习 笔记 3

标签:

原文地址:http://www.cnblogs.com/oneMTime/p/4380547.html

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