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

541
Views
typescript new line character in string is not working

I'm using a directive to show a tooltip text:

<i class="fas fa-info-circle" [nz-tooltip]='infoBulleContent'  nzTooltipPlacement='topRight'></i>

in ts code, this.infoBulleContent = 'Some text \n some text'; but the \n is not working, i used also the br tag, same result!

any help please

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

This won't work, alas. As you can see in the source of this tooltip component, the title that you give is not parsed but directly included as a string in the template.

Having said that, what you probably want here is to pass a TemplateRef, which allows you to include multiple lines, but also styling (which is preferable over using manual br-line breaks). E.g.

    <!-- Element that should have a tooltip -->
    <button nz-tooltip [nzTooltipTitle]="titleTemplate">Test</button>

    <!-- Contents of tooltip -->
    <ng-template #titleTemplate>
      <p style="font-size: 25px">Your <br> tooltip</p>
    </ng-template>
over 4 years ago · Santiago Trujillo Report

0

\n does not cause a line break in html. You'll need to use a <br/> or wrap your text in a block element.

this.Values += this.Id + ',' + this.status + '<br/>';

or

this.Values += '<div>' + this.Id + ',' + this.status + '</div>';
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!