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 ...
随机推荐
- Storm,Spark和Samza
http://www.csdn.net/article/2015-03-09/2824135 Apache Storm 在Storm中,先要设计一个用于实时计算的图状结构,我们称之为拓扑(topolo ...
- Example 2 - contour plots
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" begin cdf_file = addfile("$N ...
- 解决COMODO Internet Security更新慢或失败的问题
方法一: COMODO 默认更新服务器只有一个:http://download.comodo.com/ 我电信网络更新速度非常慢: 实在没有办法了,找到了几个更新服务器: http://eu1.dow ...
- 在我的电脑右键 Manage 拒绝访问的解决方法
为什么我的电脑右键里的“管理”会变成“manage”啦.原来是中文的,点了之后出来一个对话框,标题是“桌面”说是“拒绝访问” 是系统环境变量里少了 windir=C:\WINDOWS 方法是:打开系统 ...
- ML2 Extension Manager
The extension manager for ML2 was introduced in Juno (more details can be found in the approvedspec) ...
- 激活idea2018
首先下载安装完成后,打开hosts文件,新增一条路由: 0.0.0.0 account.jetbrains.com 打开软件输入序列码: EB101IWSWD-eyJsaWNlbnNlSWQiOiJF ...
- Sobel边缘检测
Sobel算子:[-1 0 1 -2 0 2 -1 0 1] 用此算子与原图像做卷积,可以检测出垂直方向的边缘.算子作用在图像的第二列,结果是:200,200,200:作用在第三列,结果是 ...
- node.js+express+jade系列七:富文本编辑框的使用
下载nicEdit富文本编辑框, 把nicEdit.js文件放到public/javascripts/下 新建jade文件:代码如下 doctype htmlhtml head t ...
- urllib,urlib2与httplib,urllib3
urllib:编码参数离不开urllib,urllib.urlencode, urllib.urlopen(URL,[,data]) 支持POST,根据参数区分post或者get urllib2:发送 ...
- Python 转义字符中没有这个 「\e」 !
问题来源于技术交流群里: 常见的转义字符 \n.\t 之类的我们都知道什么意思,但是这个 \e 是什么意思呢? 抱着一股钻研的精神,我搜了一把. 结果,所有的页面里都是只有一句简单的 \e 代表转义. ...