M
M
medwed20052016-01-06 02:17:54
Angular
medwed2005, 2016-01-06 02:17:54

How to convert string to HTML in ng-repeat?

I get a REST string something like:

<strong>Здесь обычный текст словами.</strong><em> </em>С

I'm trying to display through {{}} displays as it is.
I'm trying to output via ng-bind-html
I get the same thing but only the > codes are replaced with quotes and the following is obtained:
<strong>Здесь обычный текст словами.</strong><em> </em>С

I tried using the function below to display in ng-bind-html
$scope.renderHtml = function(html_code)
{
return $sce.trustAsHtml(html_code);
};
And still it turns out:
<strong>Здесь обычный текст словами.</strong><em> </em>С

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-01-06
@AMar4enko

The API returns you the text parsed by php.net/manual/ru/function.htmlspecialchars.php
If you need to paste this text as an html fragment via ng-bind-html, you need to reverse the process first.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question