AngularJs(Part 8)--Filters
Filters
AngularJS provides fileters to transfrom data from one kind to another . For example:
{{user.birthday | date:'yyyy-MM-dd'}}
In this example, the date filter is used to format user's birthday.
A filter is nothing more than a global,named function that is invoked in view using the pipe(|)
symbol with parameters separated by the colon(:).
Fileters can be combined(chained) to form a pipeline.
{{myLongString | limiTo:80 | lowercase}}
Generally,there are two kind of filters built in AngujarJS: formatting fileters and array-transforming
filters.
array-transforming filters:limitTo; filter;orderBy.
ng-repeat="item in logs | filter:{name:criteria,done:false}"
the "filter" filter can also accept a function as it parameter.
ng-repeat="item in logs | filter:checkName"
$scope.checkName=function(item){
return item.done=true;
}
sometime, we want the result of the "filter" filter for other use, like showing the size, then we can
ng-repeat="item in filteredLogs=(logs | filter:checkName)"
Total:{{filteredLogs.length}}
AngularJs(Part 8)--Filters的更多相关文章
- AngularJS基础总结
w3shools angularjs教程 wiki <AngularJS权威教程> Introduction AngularJS is a JavaScript framewo ...
- 转载 angularJS filter 过滤器
angularjs中的filter(过滤器) 标签: angularjsfilter 源文地址:http://www.ncloud.hk/技术分享/angularjs中的filter-过滤器/ f ...
- Angular1.x 基础总结
官方文档:Guide to AngularJS Documentation w3shools angularjs教程 wiki <AngularJS权威教程> Introd ...
- 简单介绍AngularJs Filters
网站链接:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/angular-filters/ Filter作用就是接收一个输入,通过某 ...
- Part 8 AngularJS filters
Filters in angular can do 3 different things 1. Format data 2. Sort data 3. Filter data Filters can ...
- 【07】AngularJS Filters
AngularJS Filters 过滤器可以使用一个管道字符(|)添加到表达式和指令中. AngularJS 过滤器 AngularJS 过滤器可用于转换数据: 过滤器 描述 currency[ˈk ...
- AngularJS Filters
过滤器可以使用一个管道字符(|)添加到表达式和指令中. AngularJS 过滤器 AngularJS 过滤器可用于转换数据: 过滤器 描述 currency 格式化数字为货币格式. filter 从 ...
- [AngularJS] Extract predicate methods into filters for ng-if and ng-show
Leaking logic in controllers is not an option, filters are a way to refactor your code and are compa ...
- How to Create Custom Filters in AngularJs
http://www.codeproject.com/Tips/829025/How-to-Create-Custom-Filters-in-AngularJs Introduction Filter ...
随机推荐
- [原创]java WEB学习笔记06:ServletContext接口
本博客为原创:综合 尚硅谷(http://www.atguigu.com)的系统教程(深表感谢)和 网络上的现有资源(博客,文档,图书等),资源的出处我会标明 本博客的目的:①总结自己的学习过程,相当 ...
- 【leetcode刷题笔记】Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. 题解:以strs[0]为模 ...
- 【leetcode】Balanced Binary Tree
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...
- dbgrid,datasoure,ClientDataSet的简单应用
dbgrid是用来在界面上显示数据的,需要连接源dbgrid1.datasource := datasource1; datasource:作为dbgrid,clientDataset的连接桥梁,需要 ...
- linux共享库加载
参考自: <<程序员的自我修养--链接.装载与库>> 第八章 Linux共享库的组织 以下截取部分内容 (这本书比较好的讲解了从程序的链接,装载,到运行) 共享库的兼容性 li ...
- 圆方树&广义圆方树[学习笔记]
仙人掌 圆方树是用来解决仙人掌图的问题的,那什么是仙人掌图呢? 如图,不存在边同时属于多个环的无向连通图是一棵仙人掌 圆方树 定义 原先的仙人掌图,通过一些奇妙的方法,可以转化为一棵由圆点,方点和树边 ...
- 算法(Algorithms)第4版 练习 1.5.23
package com.qiusongde; import edu.princeton.cs.algs4.StdOut; public class Exercise1523 { public stat ...
- NLP-最小编辑距离
最小编辑距离 一 概念 编辑距离(Edit Distance),又称Levenshtein距离,是指两个字串之间,由一个转成另一个所需的编辑操作次数.最小编辑距离,是指所需最小的编辑操作次数. 编辑操 ...
- 第二天(1)声明式验证之使用验证框架验证域模型和ModelDriven验证
有一类特殊的属性,即这个属性的类型是另外一个JavaBean,如有一个User类,代码如下: package data; public class User { private String name ...
- Codeforces 479E Riding in a Lift:前缀和/差分优化dp
题目链接:http://codeforces.com/problemset/problem/479/E 题意: 有一栋n层的房子. 还有一个无聊的人在玩电梯,每次玩电梯都会从某一层坐到另外一层. 他初 ...