1

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.

1 Answer 1

3

$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 {

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.