angular - how to perform multiple buttons event handling onclick in listview -
i have 3 buttons in listview. need perform multiple button click trigger same method checkinstall
. dont know how do. 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 dont know how button id second , third button trigger separately checkinstall handle functionalities hide , show buttons.
$event
angular key word, has output emitted value, 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 parameter method
checkinstall(args: eventdata, buttonindex: number, index : number) : void { }
Comments
Post a Comment