Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

585
Views
¿Cómo representar una cadena con etiquetas html en Angular 4+?

En mi aplicación angular 4, tengo una cadena como

 comment: string; comment = "<p><em><strong>abc</strong></em></p>";

Cuando sirvo este texto en mi html, como

 {{comment}}

Luego muestra:

 <p><em><strong>abc</strong></em></p>

Pero necesito mostrar el texto "abc" en negrita y cursiva, como abc

¿Cómo puedo hacer esto?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Use el enlace de propiedad de sintaxis de flujo unidireccional:

 <div [innerHTML]="comment"></div>

De angular docs : "Angular reconoce el valor como inseguro y lo desinfecta automáticamente, lo que elimina la etiqueta <script> pero mantiene contenido seguro como el elemento <b> ".

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!