How to switch a list item button on click


#1

hey guys, am implementing a list view containing item avatars with each item having an icon on the right so that when the icon is clicked it initiates a server communication, what am trying to do is switch the icon for a spinner while waiting confirmation from the server and switch to another icon upon completion… like the one on social media add/follow button. I tried using switch/switch-when but it changes the icon of all the items not just one. Pls is there anyway i can accomplish this with ionic?


#2

You could pass the index of the item in order to set a variable that only changes that items status, then use ng-class to change the icon based on the status.

If you provided some code or a codepen, I can explain it in terms of your markup.