简体   繁体   中英

Angular ng-bind-html not sanitizing apostrophe

I'm using ng-bind-html to sanitize HTML in a directive template:

<h2><a href="{{ post.url }}" ng-bind-html="post.title"></a></h2>

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-bind-html可以满足您的很多需求,但是要超越基本需求,您应该研究$ sce服务

I'm not really sure if I understand your question but why don't try escaping the appostrophe with slash? Like

\"

or

\'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM