0

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 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Right. I have split it to two q. Thanks
FYI - To use ng-bind-html, you need to include ngSanitize and use $sce.trustAsHtml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.