码迷,mamicode.com
首页 > 编程语言 > 详细

AngularJS(v1.4.0-rc.1) filter 从数组项中选择一个子集

时间:2015-05-16 01:39:09      阅读:328      评论:0      收藏:0      [点我收藏+]

标签:web   js   angular   filter   angularjs   

<!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>
	Search: <input ng-model="query">

	<div ng-controller="PhoneListCtrl">
		<ul>
			<li ng-repeat="phone in phones|filter:query">
				{{phone.name}}
				<p>{{phone.snippet}}</p>
			</li>
		</ul>
	</div>
</body>
</html>


AngularJS(v1.4.0-rc.1) filter 从数组项中选择一个子集

标签:web   js   angular   filter   angularjs   

原文地址:http://antlove.blog.51cto.com/10057557/1651706

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