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

AngularJS_对象数组-filter-orderBy

时间:2016-01-05 00:04:00      阅读:313      评论:0      收藏:0      [点我收藏+]

标签:

 1 <!doctype html>
 2 <html>
 3 <head>
 4 <meta charset="utf-8">
 5 <title>无标题文档</title>
 6 <script src="http://apps.bdimg.com/libs/angular.js/1.3.9/angular.min.js"></script>
 7 </head>
 8 
 9 <body>
10 <div ng-app="myApp" ng-controller="myCtl">
11     输入过滤字符:<input type="text" ng-model="test">  
12     <ul>
13         <li ng-repeat="x in names | filter:test | orderBy:‘firstname‘">
14         {{x.firstname+‘,‘+x.lastname}}
15         </li>
16      </ul>
17 </div>
18 <script>
19 var app=angular.module("myApp",[]);
20 app.controller("myCtl",function($scope){
21     $scope.names=[{firstname:john,lastname:cena},{firstname:bill,lastname:gates}];
22 });
23 </script>
24 </body>
25 </html>

 

AngularJS_对象数组-filter-orderBy

标签:

原文地址:http://www.cnblogs.com/cag2050/p/5100587.html

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