Problem with on-hold events triggered by buttons which themselves are removed by said on-hold events


#1

As the title says, an on-hold event triggered by a button which itself is removed by the on-hold event has a problem.
The first list-item containing the button is removed, but when I then try to remove the second list-item, the second button’s on-hold event can not be triggered, unless I click/touch any element. then it works again.
My guess it the mouseUp/touch-end event is not triggered because the element which triggered the mouseDown/touch-start is not there anymore, requiring you to touch something to reset the ‘touch status’.

any smart solutions to this problem? is there a way to send a touch-end event by itself and should this be bound to the same element? or would it be better to write a new directive for this particular on-hold?

I tried searching the web, but found it hard to find the right words to find a solution. and I would probably have to end up reading ionic source to find out what to change in the new directive, and that would probably be hard, since I only started learning js,angular and ionic a month ago. So if someone has a solution, let me know:)


#2

Ok, after writing this, I just came up with a sort-off workaround, I changed the button to set on-hold=“onhold=true;” and added a conditional for that in a function called by the on-release.

<button 
on-hold="onhold=true;" 
on-release="toggleFav(event,onhold); onhold=false;" 
ng-click="$event.preventDefault(); $event.stopPropagation();" 
class="button button-clear icon abs_fav button-icon" ng-class="!favIdList[event._id] ? 'ion-ios-star-outline button-light' : 'ion-ios-star button-energized' "></button>

this however only removes the item on-release and not after a certain time, which I would rather have. but it will do for now.