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 ...
随机推荐
- 牛客小白月赛1 H 写真がとどいています 【循环】
题目链接 https://www.nowcoder.com/acm/contest/85/H 思路 如果熟悉 五线谱 才能做啊... 然后 先竖着遍历 再 横着 遍历 就可以了 AC代码 #inclu ...
- 【leetcode刷题笔记】Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题 ...
- 剑指offer之 二叉树镜像
package Problem19; /* * 问题描述: * 请完成一个函数,输入一个二叉树,该函数输出它的镜像; */ //定义二叉树的结构 class BinaryTreeNode { Bina ...
- Bootstrap(二)段落+强调内容
在Bootstrap中为文本设置了一个全局的文本样式(这里所说的文本是指正文文本): 1.全局文本字号为14px(font-size). 2.行高为1.42857143(line-height),大约 ...
- Linux - xshell上传文件报错乱码
xshell上传文件报错乱码,解决方法 rz -be 回车 下载sz filename
- JS高阶函数的理解(函数作为参数传递)
JS高阶函数的理解 高阶函数是指至少满足下列条件之一的函数. · 函数可以作为参数被传递 · 函数可以作为返回值输出 一个例子,我们想在页面中创建100个div节点,这是一种写法.我们发现并不是所有用 ...
- php数据结构课程---2、链表(php中 是如何实现单链表的(也就是php中如何实现对象引用的))
php数据结构课程---2.链表(php中 是如何实现单链表的(也就是php中如何实现对象引用的)) 一.总结 一句话总结: php是弱类型语言,变量即可表示数值,也可表示对象:链表节点的数据域的值就 ...
- codeforces 628C C. Bear and String Distance
C. Bear and String Distance time limit per test 1 second memory limit per test 256 megabytes input s ...
- Java中日期和时间的相关问题
1.java.lang.System类 System类提供的public static long currentTimeMillis()用来返回当前时间与1970年1月1日0时0分0秒之间以毫秒为单位 ...
- 【caffe】卷积层代码解析
1.Forward_cpu conv_layer.cpp template <typename Dtype> void ConvolutionLayer<Dtype>::For ...