0

I have in my controller a variable, which is defined on the $scope, which contains an html input.

function init() {
        $scope.message = params.message;
    }

Where params.message could be for example something like this:

<h1>Hellow world</h1><p>Hi again</p><br><br> <b> End </b>

in the html I use it like this:

    <div ng-show="showTab == 'EN'">
        <div class='library-padding'>
            <p>{{message}}></p>
        </div>
    </div>

I want it to be shown as parsed html, meaning that the tags themselves will not appear, but it's displayed as plain text, including all tags.

How can I make this input text parsed and behaving like html?

Thanks!

1 Answer 1

1

You're looking for the ngBindHtml directive:

https://docs.angularjs.org/api/ng/directive/ngBindHtml

<div ng-show="showTab == 'EN'">
    <div class='library-padding'>
        <p ng-bind-html="message"></p>
    </div>
</div>
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.