My app is 100% offline, I store data in arrays.
While it is ok for short strings where I do not need formatting; for longer text, I 'd like to put some HTML tags in my value/key pair. It is possible to do that , and is so, how ?
Thank you for your help .
Here is the jsfiddle where I had put in yellow as an example the content type for which i’d like to add HTML tags
You can use ngBindHtml like this:
<p class="item_description" ng-bind-html="dish.description"></p>
You’ll get an error in the console:
Error: [$sce:unsafe] Attempting to use an unsafe value in a safe context.
You can prevent this by including ngSanitize in your module, or wrapping the value in
$sce.trustAsHtml. There’s a Stack Overflow answer here that shows you how to use it as a filter.
ahhh ! Brandy ! thanks, perfect, worked as a charm
Response html i’m getting from the server has the angular directives in it.
I used ng-bind-html bind the html but the the 'angular directives" are not getting compiled.
Please help me with this issue
Thanks for your reply, I tried creating the compile directive but no use,
If I replace the index.html content with the html response content , the directives are getting compiled. But if I try to bind using ng-include or ng-bind-html or compile, angular directives are not getting compile.