angular过滤器三
来源:互联网 发布:gta5优化怎么样 编辑:程序博客网 时间:2024/06/03 21:27
<html> <head> <script src="js/angular.min.js"></script> <script type="text/javascript"> function windowScopedFilter (input) { var output = []; angular.forEach(input, function(v,k){ console.log(k+":"+ v);; }); return output; } var myapp = angular.module('MyFilterApp', []); myapp.filter('myfilter', function() { return function(input, param1) { console.log("------------------------------------------------- begin dump of custom parameters"); console.log("input=",input); console.log("param1(string)=", param1); var args = Array.prototype.slice.call(arguments); console.log("arguments=", args.length); if (3<=args.length) { console.log("param2(string)=", args[2]); } if (4<=args.length) { console.log("param3(bool)=", args[3]); } console.log("------------------------------------------------- end dump of custom parameters"); // filter if (5<=args.length) { return window[args[4]](input); } return input; }; }); myapp.controller('MyFilterController', ['$scope', function($scope) { $scope.friends = [{name:'John', phone:'555-1276'}, {name:'Annie', phone:'800-BIG-MARY'}, {name:'Mike', phone:'555-4321'}, {name:'Adam', phone:'555-5678'}, {name:'David', phone:'555-8765'}, {name:'Mikay', phone:'555-5678'}]; }]); </script> </head> <body ng-app="MyFilterApp"> <div ng-controller="MyFilterController"> <table id="searchTextResults"> <tr><th>Name</th><th>Phone</th></tr> <tr ng-repeat="friend in friends |myfilter:'John':'555-1276':true:'windowScopedFilter'"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> </tr> </table> </div> <hr> </body> </html>
0 0
- angular过滤器三
- 三,Angular过滤器
- angular过滤器
- angular过滤器
- Angular过滤器
- Angular过滤器
- angular过滤器
- Angular过滤器
- angular过滤器
- angular 过滤器
- angular过滤器
- Angular过滤器
- angular过滤器
- angular过滤器、自定义过滤器
- angular自定义过滤器
- angular过滤器二
- angular js过滤器
- Angular之解读过滤器
- 《自定义组件》下拉快速选择组件
- 资本资产定价模型CAPM
- cocos2D-x3.4 新建项目的批处理文件
- android 通过 包名启动Activity及intent.addCategory(Intent.CATEGORY_LAUNCHER);遗留问题
- angular过滤器二
- angular过滤器三
- Longest Palindromic SubString -- LeetCode
- 十种数组排序方法
- POJ 1080 解题报告
- springmvc实现多文件上传
- 阿里,20150402春季实习生招聘在线试题(单选部分+附加题)
- mysql 1449 : The user specified as a definer ('test01'@'%') does not exist 解决方法
- Javascript自动为对象添加getter/setter方法(闭包方式)
- VS2013编译duilibv1.1,“找不到Riched20.lib”的问题