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

200
Vistas
I have a button and an icon inside a function can be lauched with. How can I drag the button without triggering the icon?

If I touch the icon and drag the button, then the functions triggered by the icon must not be launched. What must I do?

<div>
    <button type="button" class="fixed-button wobble" [style.background]="changeColorService.defaultStyles.firstDesignBackgroundColor" [appMovable]="true">
      <mat-icon [style.color]="changeColorService.defaultStyles.firstDesignFontColor" *ngIf="!(changeKagListIcon)" (click)="openKagListDialog()" matTooltip="KAG-Liste öffnen" [appMovable]="true">dvr</mat-icon>
      <mat-icon [style.color]="changeColorService.defaultStyles.firstDesignFontColor" *ngIf="changeKagListIcon" (click)="dialog.closeAll()" matTooltip="KAG-Liste schließen" [appMovable]="true">close</mat-icon>
    </button>

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I am not quite sure what you mean, but consider to call event.stopPropagation().

    <button (click)="specialFnc()">
      <mat-icon (click)="$event.stopPropagation()"></mat-icon> 
    </button>

If you click the icon the specialFnc won't get called. So if you like this behavior, for the drag event - just stop the event chain at the desired point.

I don't know which directive [appMovable] is, but within the drag handling you have to call stopPropagation.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Javascript event.stopPropagation() will help child event bubbling on Parent element Onclick events.

Example,

<button (onclick)="stopChildTrigger($event)">
   <mat-icon><mat-icon>
</button>

stopChildTrigger(e){
   e. stopPropagation();
}
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