0

I have a html value inside my scope, i need to append it inside a div, how do i do that?

Example:

$scope.htmlValue = '<p> text text <\p>'; 

Html : 

<div> {{ htmlValue }} <\div> 

Thanks !!

0

2 Answers 2

0

You are not using AngularJS correctly. If you need to modify the HTML, you should probably be in a directive.

That being said, you need to tell angular ahead of time what can be trusted as html and then you can use the ng-bind-html directive to bind to html. You will need to use $sce.trustAsHtml(). Related post.

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

Comments

0

What you probably need is $sanitize service. take a look here https://docs.angularjs.org/api/ngSanitize/service/$sanitize

However, as has been already meantioned, it is very likely you are not using angularJS in expected way.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.