角NG绑定,HTML不消毒撇号 [英] Angular ng-bind-html not sanitizing apostrophe
本文介绍了角NG绑定,HTML不消毒撇号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用 NG-绑定-HTML
来消毒在指令HTML
模板:
<h2><a href="{{ post.url }}" ng-bind-html="post.title"></a></h2>
编译输出是正确的,但有一个例外,它不消毒正在被打印为 A€TM
的HTML撇号。该网页是EN codeD为的charset =UTF-8
。
The compiled output is correct, with one exception, it's not sanitizing the HTML apostrophe which is being printed as â€tm
. The page is encoded as charset='utf-8'
.
推荐答案
NG-绑定-HTML
做了很多关于您的需求,但要超越基本的,你应该调查 $ SCE服务
ng-bind-html
does a lot for your needs, but to go beyond the basic you should investigate the $sce service
这篇关于角NG绑定,HTML不消毒撇号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文