I am triying to output simples html unicode characters, for example ♣
from an expression.
I have tried to use ng-bind-html
and ng-bind-html-unsafe
but i can't make it appear in my HTML.
$scope.character = '♣';
<span ng-bind-html="{{character}}"></span>
- The html code is not injected into the span balise
- The html code is not interpreted (the html character doesn't appear in my console, but if i don't use an expression from a controller and directly call
<span ng-bind-html="♣"></span>
, i can see the HTML character correctly interpreted in my console, but still not injected into the span balise)
How to output html characters from an expression ?
I import the script //ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-sanitize.min.js
and add the ngSanitize
dependency in my app.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…