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

543
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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