Sana Joseph
Sana Joseph

Reputation: 1948

Display raw HTML markup from CKEditor in Angular template

I use CKEditor in my AngularJS Application. When I try to display the text that I saved from the TextEditor, it doesn't take the style. For Example if I want to display a sentence it appears as:

<p>How old are you</p>

instead of :

How old are you

I tried using ng-bind:

<div ng-bind="Item.Header"></div>

and the regular binding method:

<h3>{{Item.Header}}</h3>

But both methods didn't work. Is there a solution for this issue?

Upvotes: 0

Views: 2667

Answers (1)

Sana Joseph
Sana Joseph

Reputation: 1948

You should use "ngBindHtmlUnsafe". Since this command doesn't sanitize the expression, but you should only use it if you trust the source.

So the html will be written as follows:

<div ng-bind-html-unsafe="Item.Header"></div>

Upvotes: 2

Related Questions