Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.4K
Vistas
Angular, How to display text without the HTML tags?

I have a string stored in my localStorage with the HTML tags since I use ngx-quill (Angular Rich Text Editor) which stores the data in HTML formatted text.

This is what my localStorage looks like: enter image description here

As you can see from the picture above, in description, there is p tags.

Is there any way I can display it on Angular page without the tags? enter image description here

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You need to use innerHTML and make sure that you trust the HTML if it contains script tag else Angular will throw an error.

Do the following, create a safeHTML pipe:

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

    @Pipe({ name: 'sanitizeHtml' })
    export class SanitizeHtmlPipe implements PipeTransform {
    
        constructor(private sanitizer: DomSanitizer) { }
    
        transform(html: string): any {
            return this.sanitizer.bypassSecurityTrustHtml(html);
        }
    }

and then use this with innerHTML like this:

<span [innerHTML]="description" | sanitizeHtml"></span>
over 4 years ago · Santiago Trujillo Denunciar

0

Use: [innerHTML] for that, for example:

<div [innerHTML]="data.description"></div>
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda