首页 > 代码库 > angularjs--过滤器
angularjs--过滤器
angularjs--过滤器
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> 6 <title>index</title> 7 <link href="http://www.mamicode.com/{$Think.const.CSSURL}bootstrap.min.css" rel="stylesheet" type="text/css"/> 8 <script src="http://www.mamicode.com/{$Think.const.JS}jquery.min.js" type="text/javascript"></script> 9 <script src="http://www.mamicode.com/{$Think.const.JS}bootstrap.min.js" type="text/javascript"></script> 10 <script src="http://www.mamicode.com/{$Think.const.JS}angular.min.js" type="text/javascript"></script> 11 <link href="http://www.mamicode.com/{$Think.const.CSSURL}home/index.css" rel="stylesheet" type="text/css"/> 12 </head> 13 <body ng-app="myapp" ng-controller="myctrl"> 14 <div class="container"> 15 <div class="form-group"> 16 <label for="">输入货币:</label> 17 <input type="text" class="form-control" ng-model="ccy"/> 18 </div> 19 <div class="well">货币:{{ccy|currency}}</div> 20 21 <div class="form-group"> 22 <label for="">输入用户:</label> 23 <input type="text" class="form-control" ng-model="name"/> 24 </div> 25 <div class="well">用户:{{name|uppercase}}</div> 26 27 <div class="form-group"> 28 <input type="text" class="form-control" ng-model="find"/> 29 </div> 30 <div class="list-group"> 31 <a href="http://www.mamicode.com/#" class="list-group-item" ng-repeat="row in rows|filter:find|orderBy:‘age‘">{{row.name}}</a> 32 </div> 33 34 <img src="http://www.mamicode.com/{$Think.const.HOMEIMG}/01.png" /> 35 </div> 36 </body> 37 <script> 38 app = angular.module("myapp",[]); 39 app.controller("myctrl",function($scope){ 40 $scope.rows=[ 41 {"name":"tom","age":"10"}, 42 {"name":"jack","age":"102"}, 43 {"name":"make","age":"101"}, 44 {"name":"mill","age":"102"}, 45 {"name":"till","age":"100"}, 46 {"name":"mac","age":"1"}, 47 ]; 48 }); 49 </script> 50 </html>
angularjs--过滤器
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。