Search code examples
htmljsonangular7angular8

How to bind html from JSON API in Angular 8



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


Solution

  • 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