Last days I was struggling with implementation of Angular JS on one my websites: www.pensiunealajura.ro/mobil/
The big issue with this was to list HTML code without listing HTML tags like < or >. For instance, I wanted to have
This is a bold text.
not
This is a <b>bold text</b>.
So, I tried to have this with the module ngSanitize and $sanitize and $sce with $sce.trustAsHtml.
But all of these were not good. And i dug more. And I found out that the best way to write formatted HTML code into a web page using Angular JS is using directive ngBindHtml as is explained here:
https://docs.angularjs.org/api/ng/directive/ngBindHtml
Now, everything is ok with my page.
:)
No comments:
Post a Comment