Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

206
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda