Angular encode HTML data when i using innerHTML

Discussão em 'Angular' iniciado por Vương Nguyễn, Agosto 13, 2025.

  1. I'm using Angular v19, innerHTML encode HTML data from API
    I checked value return from Pipe but no problem

    data.Content = <p>I had a problem using angular</p>


    HTML:

    <div [innerHTML]="data.Content | safeHtml"></div>


    Pipe:

    transform(value: string) {
    return this.sanitized.bypassSecurityTrustHtml(value);}


    The result i check by dev tool:

    <p>I&nbsp;had&nbsp;a&nbsp;problem&nbsp;using&nbsp;angular</p>


    I want to display my HTML from the API without editing. How can i do that ?

    Continue reading...

Compartilhe esta Página