HTML angular过滤关键字
来源:互联网 发布:弱电箱的网络模块 编辑:程序博客网 时间:2024/05/22 08:13
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript">
var app = angular.module("myApp", []);
app.filter("replace", function() {
return function(text) {
function replaceValue(text) {
var value = "";
if(text.indexOf("zz")>=0) {
//alert("111");
value = text.replace(/zz/g, "**");
if(value.indexOf("a")>=0){
return value.replace(/a/g, "*");
}else{
return value;
}
}else if(text.indexOf("a")>=0){
value = text.replace(/a/g, "*");
if(value.indexOf("a")>=0){
return value.replace(/a/g, "*");
}else{
return value;
}
}else{
if(value.indexOf("a")>=0){
return text.replace(/a/g, "*");
}else{
return text;
}
}
}
return replaceValue(text);
}
});
app.controller("myCtrl", function($scope) {
$scope.value = "zz";
})
</script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
请输入:<input ng-model="value" />
<p>{{value | replace}}</p>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript">
var app = angular.module("myApp", []);
app.filter("replace", function() {
return function(text) {
function replaceValue(text) {
var value = "";
if(text.indexOf("zz")>=0) {
//alert("111");
value = text.replace(/zz/g, "**");
if(value.indexOf("a")>=0){
return value.replace(/a/g, "*");
}else{
return value;
}
}else if(text.indexOf("a")>=0){
value = text.replace(/a/g, "*");
if(value.indexOf("a")>=0){
return value.replace(/a/g, "*");
}else{
return value;
}
}else{
if(value.indexOf("a")>=0){
return text.replace(/a/g, "*");
}else{
return text;
}
}
}
return replaceValue(text);
}
});
app.controller("myCtrl", function($scope) {
$scope.value = "zz";
})
</script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
请输入:<input ng-model="value" />
<p>{{value | replace}}</p>
</body>
</html>
阅读全文
0 0
- HTML angular过滤关键字
- angular js 过滤关键字
- angular html不过滤
- 关键字过滤
- 关键字过滤
- 关键字过滤
- 关键字过滤
- 关键字过滤 脏话过滤
- angular表情过滤
- Angular过滤敏感词
- angular(过滤查询)
- angular 双向绑定把字符串文本过滤成html文本(自定义过滤器)
- HTML过滤
- 过滤html
- angular事件关键字
- 过滤关键字大全-网页关键字过滤-sql注入关键字过滤
- 过滤关键字大全-网页关键字过滤-sql注入关键字过滤
- angular中的过滤使用浅析
- 整数格式化输出
- notepad++ 批量替换技巧
- 详解Inten t转自(http://www.cnblogs.com/engine1984/p/4146621.html)
- 2017年第14届中国国际文具礼品博览会会刊(参展商名录)
- ActiveMQ
- HTML angular过滤关键字
- vue-cli vue2.0如何使用引入less或者sass
- 深度学习入门心得——书籍、课程、文档推荐
- Studio 打包以及Gradle配置
- 如何编译安装 protocolBuffer(for C++)
- 直流电机PWM调速系统中控制电压非线性研究
- memcached存储机制与过期机制
- mysql 模拟redo文件损坏测试
- equals和hashcode终极解答