1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular [innerHTML] renders content twice

Discussão em 'Angular' iniciado por Djordje Dursun, Setembro 12, 2024.

  1. This is is my html:

    <p class="description" [innerHTML]="standardData.details.description | safeHtml"></p>


    And i will get 2 "p" tags with my html if it's rendered server side,

    I Checked the standardData.details.description and it's fine, but i recently updated my angular to version 16, so mayble it's related to that

    This is my Pipe:

    import { Pipe, PipeTransform } from '@angular/core';
    import { DomSanitizer } from '@angular/platform-browser';

    @Pipe({ name: 'safeHtml' })
    export class SafeHtmlPipe implements PipeTransform {
    constructor(private sanitized: DomSanitizer) { }
    transform(value) {
    return value ? this.sanitized.bypassSecurityTrustHtml(value) : '';
    }
    }

    Continue reading...

Compartilhe esta Página