2
var text1 = "<b>sometext</b>";     
var text2 = "&lt;b&gt;sometext&lt;/b&gt;";

ng-bind-html="text1" works fine. The result is sometext but ng-bind-html="text2" doesn't work. The result is <b>sometext<b>

How can I makeng-bind-html="text2" work. Thank you.

6
  • @simoco why did you edit this? I wanted to show first result is bolded text in html and second result is <b>sometext</b> in html Commented Jan 3, 2015 at 10:50
  • So you want in both cases bolded text? Commented Jan 3, 2015 at 10:52
  • I edited again :) Thank you anyway. Commented Jan 3, 2015 at 10:53
  • @dfsq Yes. especially for the second one. Commented Jan 3, 2015 at 10:54
  • 1
    possible duplicate of Angularjs: preview sanitized html Commented Jan 3, 2015 at 11:01

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.