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

252
Vistas
Typescript doesn't bold the text when call it in HTML

bold function doesn't work in Typescript

Hello, so I'm working on Angular project and I have a function in a typescript file that bold a specific part

      formatText() {

      ...........
      

      new_text = part1 +  word.bold()  + part2;

      return new_text;

  }

then I called I returned in an HTML file

                <div *ngFor="let sentence of sentences">
                <li>
                    {{formatText()}}
                </li>
               </div>

However what I get is the tags instead of bolding the word like this:

A young college teacher <b>leaves</b> China for the United States in search of a better future.
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try surround formatText() with <p> tag in your HTML:

<div *ngFor="let sentence of sentences">
      <li>
            <p>{{formatText()}}<p>
      </li>
</div>

Hope this would help

Minor suggest: <li> tag should be inside <ul> tag

about 4 years ago · Juan Pablo Isaza 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