1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Item deletado somente no terceiro click [closed]

Discussão em 'Angular' iniciado por Bruna Bergami, Agosto 7, 2025.

  1. I'm using Angular. I have a delete event called on a button, and the delete only executes on the third click. However, the if statement executes the first time. I've tried changing the order, putting the delete before the if statement, but it didn't work.

    HTML:

    <button type="button" class="delete" mat-icon-button (click)="deletarItem()">
    <mat-icon class="material-icons-outlined fix-icon">delete</mat-icon>
    </button>


    TS:

    deletarItem() {

    if (this.filterIndex === 2 && this.groupIndex === 0 && this.tableInstance === 'exportarTabela') {
    const instanceIndex1 = `regra-item-${this.entity}-${this.tableInstance}-0-1`;
    this.scope.field.setValue('dynamicFilter', instanceIndex1, 'operador', "==");
    }

    this.delete.emit();
    }

    Continue reading...

Compartilhe esta Página