1 click calls the function 2 times in an input

When developing a new project in ionic 7.2.0

I was calling a selection modal with an input

   <ion-col size="3" (click)="modalSelecaoFornecedor(item,$event)">
              <ion-input fill="outline" label="Selecione Fornecedor" labelPlacement="floating" [value]="item.fornecedor_desc" readonly  ></ion-input>
          </ion-col>

and when calling the function (click)=“modalSelecaoFornecedor()”

it simply calls the function twice
After some research I didn’t find a reason or solution.

so I did

modalSelecaoFornecedor(item:any, $event:any){
    if($event.srcElement.type == undefined){return}

//...
}

the column performs the function and the input as well, placing the (CLICK) in the ion-input tag
it calls the function twice

the temporary solution I clicked on ion-col
and I check in the event if type == undefined since has no type

Has anyone else had this error or am I doing something very wrong?

1 Like