<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl"> <div >
<p>名字 : <input type="text" ng-model="firstName" ng-bind="firstName"></p>
<p>名字 : <input type="text" ng-model="lastName" ng-bind="lastName"></p>
<p>输入过滤 : <input type="text" ng-model="text" ng-bind="text"></p> <span>{{(firstName|lowercase)+" "+lastName}}</span>
<span>{{5|currency}} </span> </div>
<ul>
<li ng-repeat="x in names |filter: text |orderBy:country">
{{x.name+','+x.country}}
</li>
</ul>
<script> var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope) {
$scope.firstName = "firstName";
$scope.lastName = "lastName";
$scope.names = [
{ 'name': 's1', 'country': 'china' },
{ 'name': 's2', 'country': 'america' },
{ 'name': 5, 'country': 'america' }, ]; });
</script> </body>
</html>

  

text 绑定的过滤模型名称 li列表会过滤输入 进行模糊匹配


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl"> <div >
<p>名字 : <input type="text" ng-model="firstName" ng-bind="firstName"></p>
<p>名字 : <input type="text" ng-model="lastName" ng-bind="lastName"></p>
<p>输入过滤 : <input type="text" ng-model="text" ng-bind="text"></p> <span>{{(firstName|lowercase)+" "+lastName}}</span>
<span>{{5|currency}} </span> </div>
<ul>
<li ng-repeat="x in names |filter: text |orderBy:country">
{{x.name+','+(x.country|reverse)}}
</li>
</ul>
<script> var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope) {
$scope.firstName = "firstName";
$scope.lastName = "lastName";
$scope.names = [
{ 'name': 's1', 'country': 'china' },
{ 'name': 's2', 'country': 'america' },
{ 'name': 5, 'country': 'america' }, ]; });
//自定义一个过滤器反转字符顺序
app.filter('reverse', function () {
return function (text) {
return text.split("").reverse().join("");
} })
</script> </body>
</html>

  添加自定义过滤器 接收参数 函数内部处理后返回

												

最新文章

  1. javaweb初学记录
  2. centos 无线网卡安装,网卡rtl8188ee
  3. .net学习笔记---xml基础知识
  4. JavaScript - 引用类型
  5. PostgreSQL同步复制搭建
  6. Java中的转义字符
  7. printf()函数
  8. 阿里云大数据三次技术突围:Greenplum、Hadoop和“飞天”
  9. vijos 1907 飞扬的小鸟
  10. http://blog.csdn.net/wxwzy738/article/details/16968767
  11. C语言1-100连加,求质数,算瑞年检测字母大小写,登录系统
  12. 移动Web开发小技巧
  13. DB2常用sql demo
  14. CodeForces 616B Dinner with Emma
  15. EasyUI datagrid 使用小结
  16. JavaScript 图
  17. C++一个类对象的大小计算
  18. Flask 视图,中间件
  19. python(list、字典、元组、字符串方法、文件读写)草稿
  20. nodejs -Promise

热门文章

  1. winform 使用SplashScreen窗口
  2. [HTML/CSS]div显示在object、embed之上~
  3. 原生js操作HTML DOM
  4. node webkit (nw.js) 无法调试的结局方案之一
  5. bash中的通配符使用
  6. JavaScript基础入门教程(二)
  7. python笔记15-ini配置文件(configparser)
  8. iOS开发--地图与定位
  9. iOS:文本视图控件UITextView的详细使用
  10. Python datetime 格式化字符串:strftime()