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 ...
随机推荐
- redis于spring整合之RedisTemplate
原文地址: http://www.jianshu.com/p/7bf5dc61ca06
- Data Structure Array: Largest subarray with equal number of 0s and 1s
http://www.geeksforgeeks.org/largest-subarray-with-equal-number-of-0s-and-1s/ #include <iostream& ...
- Eclipse cdt mingw配置记录
本人下载的是Eclipse C/C++ IDE for Neon.3,下载页面是:http://www.eclipse.org/cdt/downloads.php. 1. 运行eclipse后,在He ...
- Python运算和和表达式 学习笔记
光荣之路Python公开课第二讲 Python运算符和表达式. 一 Python运算符 Python运算符包括 算术运算符,赋值运算符,位运算符,逻辑运算符,身份运算符,成员运算符. 1. 算术运算符 ...
- Cocos2dx版本与CocosBuilder版本匹配问题
我用的是CocosBuilder 2.1版本,将ccbi导入到xcode 5中时提示: WARNING! Incompatible ccbi file version 警告;ccbi版本不兼容. 查看 ...
- java.sql.SQLException: Column count doesn't match value count at row 1 Query: insert into category values(null,?,?,?) Parameters: [1111111, 1111, 软件]
java.sql.SQLException 问题: java.sql.SQLException: Column count doesn't match value count at row 1 Que ...
- 分享知识-快乐自己:N及分类(双重循环、递归)实现
实现多级分类: 1.双重 for 循环实现 N 及分类 /*** * 执行遍历 * * @param menus * 所有权限列表集合 * @param list * 指定角色查询到的 权限Id * ...
- 全面解析Bootstrap手风琴效果
触发手风琴可以通过自定义的data-toggle 属性来触发.其中data-toggle值设置为 collapse,data-target="#折叠区标识符". 第一步:设计一个面 ...
- Git_错误_03_ Git提交时显示用户 unknown
这是因为没有设置用户名 $ git config --global user.name "your_name" $ git config --global user.email & ...
- Linux-NoSQL之Redis(二)
一.Redis配置文件详解 1.通用配置 daemonize no # 默认情况下,redis并不是以daemon形式来运行的.通过daemonize配置项可以控制redis的运行形式 pidfil ...