angularjs--过滤器
Posted 昱歌
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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="{$Think.const.CSSURL}bootstrap.min.css" rel="stylesheet" type="text/css"/> 8 <script src="{$Think.const.JS}jquery.min.js" type="text/javascript"></script> 9 <script src="{$Think.const.JS}bootstrap.min.js" type="text/javascript"></script> 10 <script src="{$Think.const.JS}angular.min.js" type="text/javascript"></script> 11 <link href="{$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="#" class="list-group-item" ng-repeat="row in rows|filter:find|orderBy:‘age‘">{{row.name}}</a> 32 </div> 33 34 <img src="{$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--过滤器的主要内容,如果未能解决你的问题,请参考以下文章