0

I am receiving this json array and using angular to display it.

Shorted example:

        $scope.results = [{"description": "\u003ca href=\"http://google.com \" target=\"_blank\"\u003eClick Here\u003c/a\u003e"}];

The problem is that the value contains html code or unicode characters that don't work properly.

I've searched and tried ng-bind-html with no luck.

In the html source code I get this:

<a href="http://google.com " target="_blank">Click Here</a&gt

Instead of this:

 <a href="http://google.com " target="_blank">Click Here</a>

Here is an example Plunker with my problem

1 Answer 1

1

You need to use ng-bind-html and then we could get the trusted Html in anchor tag rendered on the page.

Markup

<span ng-repeat="result in results" 
 ng-bind-html="result.description | unsafe">
</span>

Plunkr Here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.