Foreign Object
Foreign Object

Reputation: 1640

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'.

Upvotes: 1

Views: 1650

Answers (2)

Steve Davis
Steve Davis

Reputation: 716

ng-bind-html does a lot for your needs, but to go beyond the basic you should investigate the $sce service

Upvotes: 0

bbahov
bbahov

Reputation: 109

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

\"

or

\'

Upvotes: 1

Related Questions