<!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>

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

												

angular过滤器使用 自定义过滤器的更多相关文章

  1. angularjs学习第三天笔记(过滤器第二篇---filter过滤器及其自定义过滤器)

    您好,我是一名后端开发工程师,由于工作需要,现在系统的从0开始学习前端js框架之angular,每天把学习的一些心得分享出来,如果有什么说的不对的地方,请多多指正,多多包涵我这个前端菜鸟,欢迎大家的点 ...

  2. django模板的变量,标签,过滤器和自定义过滤器,注释

    模板的作用是计算并输出: {{ 变量}} 当模版引擎遇到点如book.title,会按照下列顺序解析: 1.字典book['title'] 2.先属性后方法,将book当作对象,查找属性title,如 ...

  3. asp.net系统过滤器、自定义过滤器

    原文地址:http://www.cnblogs.com/kissdodog/archive/2013/05/21/3090513.html 一.系统过滤器使用说明 1.OutputCache过滤器 O ...

  4. Vue.js学习 Item14 – 过滤器与自定义过滤器

    基础 类似于自定义指令,可以用全局方法 Vue.filter() 注册一个自定义过滤器,它接收两个参数:过滤器 ID 和过滤器函数.过滤器函数以值为参数,返回转换后的值: Vue.filter('re ...

  5. MVC系统过滤器、自定义过滤器

    一.系统过滤器使用说明 1.OutputCache过滤器 OutputCache过滤器用于缓存你查询结果,这样可以提高用户体验,也可以减少查询次数.它有以下属性: Duration:缓存的时间,以秒为 ...

  6. ASP.NET MVC 系统过滤器、自定义过滤器

    一.系统过滤器使用说明 1.OutputCache过滤器 OutputCache过滤器用于缓存你查询结果,这样可以提高用户体验,也可以减少查询次数.它有以下属性: Duration:缓存的时间,以秒为 ...

  7. flask框架下的jinja2模板引擎(2)(过滤器与自定义过滤器)

    flask框架下的jinja2模块引擎(1):https://www.cnblogs.com/chichung/p/9774556.html 这篇论文主要用来记录下 jinja2 的过滤器. 什么是过 ...

  8. angular中的自定义过滤器

    <!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...

  9. angularJs的过滤器扩展及自定义过滤器

    一.过滤器扩展 1.过滤器的组合使用 <!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta ...

随机推荐

  1. 【推导】【分类讨论】Codeforces Round #431 (Div. 1) B. Rooter's Song

    给你一个这样的图,那些点是舞者,他们每个人会在原地待ti时间之后,以每秒1m的速度向前移动,到边界以后停止.只不过有时候会碰撞,碰撞之后的转向是这样哒: 让你输出每个人的停止位置坐标. ①将x轴上初始 ...

  2. Problem E: 零起点学算法34——3n+1问题

    #include<stdio.h> #include<math.h> int main() { int n; n<=pow(,); ; scanf("%d&qu ...

  3. java程序中没有错,但是项目上面显示一个红叉的解决办法

    错误信息: 报Description  Resource Path Location Type Java compiler level does not match the version of th ...

  4. Android网络通信框架LiteHttp2.0 开篇简介和大纲目录

    本帖最后由 移动天宇 于 2015-10-26 10:42 编辑 LiteHttp2.0很多东东焕然一新,旧的能力也得到增强,没有使用的同学来了解一下吧. Android网络框架为什么可以选用lite ...

  5. Openshift初步学习问题集

    1.设置资源限额 详细参考 https://docs.openshift.com/enterprise/3.2/admin_guide/quota.html#sample-resource-quota ...

  6. 一、Hello Spring Boot

    package com.ld.controller; import org.springframework.web.bind.annotation.RequestMapping; import org ...

  7. WSDL-学习总结

    1.什么是WSDL 是一种使用 XML 编写的文档.这种文档可描述某个 Web service.它可规定服务的位置,以及此服务提供的操作(或方法). 2.WSDL文档结构: <binding&g ...

  8. SQL手工注入小结

    第一步先把IE菜单=>工具=>Internet选项=>高级=>显示友好 HTTP 错误信息前面的勾去掉.否则,不论服务器返回什么错误,IE都只显示为HTTP 500服务器错误, ...

  9. Struts2实现登录流程

    本节将演示一个基本的登录流程,在登录界面中若输入正确的用户名和密码,跳转到登录成功界面:否则路转到登录失败界面. 1 建立一个名为LoginDemo的动态Web项目 2 添加struts2相关的jar ...

  10. Windows安装和配置Tomcat

    1 从http://tomcat.apache.org下载Tomcat压缩包,我这里下的版本是7.0.67.   2 将Tomcat压缩包解压缩到任意路径下,我这里的解压缩路径为E:\tomcat-7 ...