问题
How do I make the string to be rendered as HTML? When doing something like:
<div>
{{ text }}
</div>
The output is just displayed at text meaning " ab "
回答1:
Regular expression:
var pattern = new RegExp(keywords.join('|'), "g");
var result = text.match(pattern);
Rending a string as HTML:
<div ng-bind-html="text"></div>
P.S: Since these are two different questions, next time you should post them separately.
来源:https://stackoverflow.com/questions/22366518/render-text-as-html-with-angularjs