Reputation: 10079
I have three buttons in listview. I need to perform multiple button click to trigger same method checkInstall
. I dont know how to do. I have added relevant code:
html file:
<ListView [items]="allAppsList" class="list-group">
.......
.......
<StackLayout row="0" col="2">
<Button text= "Install" (tap) ="checkInstall($event, myIndex)" > </Button>
<Button text= "Open" (tap) ="checkInstall($event1, myIndex)" > </Button>
<Button text= "Remove"(tap) ="checkInstall($event2, myIndex)" > </Button>
</StackLayout>
</ListView>
ts file:
checkInstall(args: EventData, index : number) : void {
}
for performing first button, checkInstall method working fine.But I dont know how to get the button id for second and third button to trigger separately for checkinstall to handle functionalities like hide and show the buttons.
Upvotes: 1
Views: 231
Reputation: 7068
$event
is an angular key word, it has the output emitted value, you can not change it
<Button text="Install" (tap)="checkInstall($event,1, myIndex)"> </Button>
<Button text="Open" (tap)="checkInstall($event, 2, myIndex)" > </Button>
<Button text="Remove"(tap)="checkInstall($event, 3, myIndex)" > </Button>
You can send a parameter to your method
checkInstall(args: EventData, buttonIndex: number, index : number) : void {
}
Upvotes: 3