html angular自定义过滤器,指定所需要替换的文字
来源:互联网 发布:周继红 田亮 知乎 编辑:程序博客网 时间:2024/06/06 00:57
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="angular.js" ></script>
<script>
var app = angular.module("myApp",[]);
app.controller("myCtrl",function($scope){
$scope.haha = "hello,angular";
});
//调用filter()方法自定义过滤器
app.filter("myFilter",function(){
return function(text){
return text.replace(/hello/,"你好");
}
});
</script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<p>{{haha | myFilter}}</p>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="angular.js" ></script>
<script>
var app = angular.module("myApp",[]);
app.controller("myCtrl",function($scope){
$scope.haha = "hello,angular";
});
//调用filter()方法自定义过滤器
app.filter("myFilter",function(){
return function(text){
return text.replace(/hello/,"你好");
}
});
</script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<p>{{haha | myFilter}}</p>
</body>
</html>
阅读全文
0 0
- html angular自定义过滤器,指定所需要替换的文字
- angular的内置过滤器及自定义过滤器
- angular过滤器的使用和自定义过滤器
- Angular的过滤器和自定义过滤器
- Angular的过滤器和自定义过滤器
- angular过滤器、自定义过滤器
- 计算以指定字体和字号输出指定文字,所需要的size 辅助函数
- angular中自定义首字母大写的过滤器
- angular自定义过滤器
- angular中的自定义过滤器
- Angular自定义过滤器
- Angular自定义过滤器
- angular自定义过滤器
- angular中自定义过滤器
- Angular自定义过滤器
- angular自定义过滤器
- angular 自定义过滤器
- angular 自定义过滤器
- Tpshop商城短信接口开发
- activiti常用api
- javascript正则表达式
- xml中TabLayout的配置
- Android
- html angular自定义过滤器,指定所需要替换的文字
- 使用Vbox 搭建centos7 11.2.0.4 RAC
- 移动端摄像头
- angular实现httpget请求
- Python实战1——address_book.py
- 7-8 直捣黄龙(30 分)
- android通讯录开发<三> 增删改查(附Demo)
- 欢迎使用CSDN-markdown编辑器
- 【Tips】Javascript中多重数字数组扁平化处理