>  기사  >  웹 프론트엔드  >  AngularJS_对象数组-filter-orderBy_html/css_WEB-ITnose

AngularJS_对象数组-filter-orderBy_html/css_WEB-ITnose

WBOY
WBOY원래의
2016-06-24 11:30:451162검색

 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>

 

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.