angular入门--自定义过滤器
<html ng-app='app1'>
<head>
<meta name="generator"
content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" />
<title></title>
<script src='E:\global\js\angular.min.js'> </script>
</head>
<body>
<div ng-controller="c1">
<input value="get the filter value" type='button' ng-click="getFilter()" />
<div ng-bind="name " ></div>
<div ng-bind="name | f1:'test page'" ng-show="isShow"></div>
</div> <script>
var app=angular.module('app1',[]);
app.controller('c1',['$scope',function($scope){
$scope.name="please input the pw";
$scope.isShow=false;
$scope.getFilter=function(){
$scope.isShow=true;
}
}])
app.filter('f1',function(){
return function(str,filterString){
return str+':custom:'+filterString;
}
})
</script>
</body>
</html>
核心代码
app.filter('f1',function(){
return function(str,filterString){
return str+':custom:'+filterString;
}
})
angular入门--自定义过滤器的更多相关文章
- angular之自定义过滤器的使用
自定义过滤器需要使用filter函数,格式如下: filter("filterName',function(){ return function(target,args){ .... } } ...
- Django入门--自定义过滤器与标签
---恢复内容开始--- 为了让Django找到自定义的模板过滤器和模板标签,需要进行文件路径配置,配置方式分为APP目录下配置和项目路径下配置两种方式: 1.在APP目录下配置:针对某个应用特定的自 ...
- -_-#【Angular】自定义过滤器
AngularJS学习笔记 <!DOCTYPE html> <html ng-app="Demo"> <head> <meta chars ...
- 简述angular自定义过滤器在页面和控制器中的使用
首先设置自定义过滤器. 定义模块名:angular ? 1 2 3 4 5 6 .module('myApp') .filter('filterName',function(){ return fun ...
- angular自定义过滤器在页面和控制器中的使用
首先设置自定义过滤器. 定义模块名:angular .module('myApp') .filter('filterName',function(){ return function(要过滤的对象,参 ...
- Angular——自定义过滤器
基本介绍 除了使用AngularJS内建过滤器外,还可以根业务需要自定义过滤器,通过模块对象实例提供的filter方法自定义过滤器. 基本使用 (1)input是将绑定的数据以参数的形式传入 (2)i ...
- angular自定义过滤器操作实例
//模块名字var filters = angular.module("customFilter",[]);//过滤器名字filters.filter("uniqueCa ...
- angular入门
angular入门 <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset=&q ...
- 秒味课堂Angular js笔记------过滤器
不同过滤器的小demo. currency number uppercase json limitTo date orderBy filter <script> var filterMy ...
随机推荐
- java实现生日相同概率
假设所有年份都只有365天,求n个人中,出现生日相同的概率. 输入n 输出相同的概率(保留3位有效数字即可) import java.util.*; public class X { // n个人出现 ...
- java实现第六届蓝桥杯九数分三组
九数分三组 题目描述 1~9的数字可以组成3个3位数,设为:A,B,C, 现在要求满足如下关系: B = 2 * A C = 3 * A 请你写出A的所有可能答案,数字间用空格分开,数字按升序排列. ...
- tensorflow2.0学习笔记第一章第一节
一.简单的神经网络实现过程 1.1张量的生成 # 创建一个张量 #tf.constant(张量内容,dtpye=数据类型(可选)) import tensorflow as tf import num ...
- ubuntu qwt6.1.0安装
1.ubuntu-12.04 qt-5.1.1 2.sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev 3.qmake 4.make 5.sud ...
- 非线性规划的Matlab 解法
编写M 文件fun1.m 定义目标函数 function f=fun1(x); % 定义目标函数 f=sum(x.^)+; % .^2是矩阵中的每个元素都求平方.^2是求矩阵的平方或两个相同的矩阵相乘 ...
- (六)logback.xml 配置详解
原文链接:https://www.cnblogs.com/taiyonghai/p/9290641.html,https://blog.csdn.net/A615883576/article/deta ...
- 授权函数-web_set_certificate_ex
设置证书和密钥文件属性. int web_set_certificate_ex(const char * option_list,LAST); 该函数与Loadrunner 录制设置属性中的Recor ...
- Android中的SharedPreferences存储
一.前言 不同于文件的存储方式,SharedPreferences是使用键值对的方式来存储数据的.也就是说,当保存一条数据的时候,需要给这条数据提供一个对应的键,这样在读取数据的时候就可以通过这个键把 ...
- 简易的phpexcel导出柱状图
首先得把phpexcel扩展的源码拷贝到项目文件下 下面是代码 /** 引入最重要的PHPExcel类库的入口文件 */ require(STK_PATH.'/class/stk/PHPExc ...
- 学员操作——制作5s关闭广告
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>广 ...