[英]Creating an AngularJS filter in order to replace double quotes with single quotes
I want to replace double quotes with single quotes in a filter like this: 我想在这样的过滤器中将双引号替换为单引号:
INPUT: This is what I want to "happen" in the filter 输入:这就是我要在过滤器中“发生”的内容
OUTPUT: This is what I want to 'happen' in the filter 输出:这就是我要在过滤器中“发生”的内容
This was my attempt: 这是我的尝试:
.filter('quoteSingle', function() {
return function(text) {
return text.replace(""", '&apos');
};
})
使用此text.replace(/"/g, "'" )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.