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

306
Vistas
Angular programmatically add ngbTooltip on event target doesn't work

I'm trying to add a tooltip on the clicked elements in my component view, which are mostly svg polygons and paths, I have tried this function to set the ngbtooltip attribute on the target clicked elements, but nothing is happening when I click an element and hover on it again, although the clicked element in my inspector appear to have the ngbtooltip attribute added

my View

<div class="col py-2" #ngbTooltipp>
    <!-- poc only -->
    <svg-icon (click)="selectSector($event)" [src]="mapPath" [svgStyle]="{ 'width.px':675}"></svg-icon>
  </div>

my ts file

 public selectSector($event: MouseEvent) {
    // set the tooltip
    let clickedEl = $event.target;
    this.renderer.setAttribute(clickedEl, "ngbtooltip", "hello");
  }
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Try this form https://ng-bootstrap.github.io/#/components/tooltip/examples#triggers

<div class="col py-2" #ngbTooltipp>
    <!-- poc only -->
    <svg-icon ngbTooltip="You see, I show up on click!" triggers="click:blur" [src]="mapPath" [svgStyle]="{ 'width.px':675}"></svg-icon>
  </div>

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use it this way

<button type="button" ngbTooltip="You see, I show up on click!" >
  Click me!
</button>

<div>
 <ng-containt ngbTooltip="You see, I show up on click!" > Click 
   <svg-icon name="eye" [svgStyle]="{ 'width.px':90 }"></svg-icon>
 </ng-containt> 
</div>

https://stackblitz.com/edit/angular-funyr5?file=src%2Fapp%2Ftooltip-triggers.html

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