A way to listen for the end of the Toggle Slider Animation


#1

So I’m having a problem where sometimes (seemingly at random) it seems like the Toggle receives an additional click. Here is a codepen of the basic functionality I have (any improvements on it are welcome): http://codepen.io/yaozer4/pen/EgzyJv

The problem I’m facing is when this gets deployed to an actual device there is a bit of a lag, which is fine, but it lets in multiple clicks on the toggle all slider and sometimes sets and unsets itself. My question is this, is there a way to listen for the end of the toggle all slider’s animation? As you can see in my codepen I have an ng-disabled on the Toggle All, but the code in the background runs too fast for it to even notice it being “disabled”. So my idea is to disable it right when you click and then re-enable it when the animation finishes. I’m still not certain that is going to solve my problem, but it’ll eliminate one particular case.