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

248
Views
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 answers
Answer question

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 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!