Now I know to use ngSanitize
and ng-bind-html
, but can I use it with ng-repeat
where I have the following logic:
<div ng-repeat="(k, v) in specs.webdev">
<h3>{{::v["job-title"]}}</h3>
<p>{{::v["job-body"]}}</p>
United Kingdom Apply Here:
<p>{{::v["job-apply"]}}</p>
</div>
specs
(where I have multiple html tags) is retrieved from JSON
file with $http.get
and parsed with .then
. So, values in "job-title"
, "job-body"
, "job-apply"
contain HTML tags that I'm trying to display here.
How can I use ng-bind-html
here?
If I understand well, just doing
<div ng-repeat="(k, v) in specs.webdev">
<h3 ng-bind-html="::v['job-title']"></h3>
<p ng-bind-html="::v['job-body']"></p>
United Kingdom Apply Here:
<p ng-bind-html="::v['job-title']"></p>
</div>
That will render the content of v['job-title'] and other properties as HTML