防止工具提示转换 HTML 实体 [英] Prevent tooltip in converting HTML Entities
本文介绍了防止工具提示转换 HTML 实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<input ng-model="test" placeholder="pre" type="text" title="PROJECT>" />
上述工具提示代码显示PROJECT>".但我需要的是将文本显示为PROJECT>"
The above code for tooltip displays "PROJECT>". But what I need is to display the text as is "PROJECT>"
有没有办法做到这一点?我正在使用角度.
Is there a way to do this? I'm using angular.
推荐答案
你可以尝试这样的事情:创建角度过滤器:
you can try something like this: create angular filter :
angular.module('ppvApp.event').filter('escapeHtml', function() {
var charMap= {
"&": "&",
"<": "<",
">": ">",
'"': '"',
"'": ''',
"/": '/'
};
return function(str) {
return String(str).replace(/[&<>"'\/]/g, function(s) {
return charMap[s];
});
}
});
然后将其用作:
<input ng-model="test" placeholder="pre" type="text" title="{{'PROJECT>' | escapeHtml}}" />
这篇关于防止工具提示转换 HTML 实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文