Question

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 "

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top