0


i am trying to display data from API in Angular 8 But this API include a html code
and when i try to show it in the page the html show up without working Like this enter image description hereenter image description here

i am wondering how can i compile the html to look like it supposed to be

1 Answer 1

1

This is answered here: Angular HTML binding

You can use either this: <div [innerHTML]="current_page.data.details"></div>

or <div innerHTML="{{current_page.data.details}}"></div>

Check the reference: https://angular.io/guide/template-syntax#property-binding-vs-interpolation

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

3 Comments

Not working and i don't think it's gonna work inside loop
sure it will work, it does matter if its a loop or not, you should use ngFor for iteration. Also you can parse the html pragmatically from your component.Please update your question and show your code (component + html template).
this one is working <div innerHTML="{{course.details}}"></div>

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.