Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

250
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda