首页 > Web开发 > 详细

AngularJS 动态模板

时间:2015-05-15 18:00:57      阅读:334      评论:0      收藏:0      [点我收藏+]

AngularJS版本 : AngularJS v1.4.0-rc.1

<!doctype html>
<html ng-app="dynamicTemplate">
<head>
	<script src="jslib/angular.js"></script>
	<script type="text/javascript">
	angular.module(‘dynamicTemplate‘, []).controller(‘PhoneListCtrl‘,function($scope) {
		$scope.phones = [
			{
				"name": "Nexus S",
				"snippet": "Fast just got faster with Nexus S."
			},
			{
				"name": "Motorola XOOM with Wi-Fi",
				"snippet": "The Next, Next Generation tablet."
			},
			{
				"name": "MOTOROLA XOOM",
				"snippet": "The Next, Next Generation tablet."
			}
		];
	});
	</script>
</head>
<body>
	<div ng-controller="PhoneListCtrl">
		<ul>
			<li ng-repeat="phone in phones">
				{{phone.name}}
				<p>{{phone.snippet}}</p>
			</li>
		</ul>
		<p>Total number of phones: {{phones.length}}</p>
	</div>

	<table>
		<tr><th>row number</th></tr>
		<tr ng-repeat="i in [0, 1, 2, 3, 4, 5, 6, 7]"><td>{{‘row number : ‘+(i+1)}}</td></tr>
	</table>

</body>
</html>


AngularJS 动态模板

原文:http://antlove.blog.51cto.com/10057557/1651667

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!