Looking for some help on how to prevent onReady
from firing multiple times in an Angular/Ionic app when used in conjunction with $window
. Specifically, we're using this method for Wistia videos (as instructed here). The offending code is:
$window._wq = $window._wq || [];
$window._wq.push({ id: "5bbw8l7kl5", onReady: function(video) {
console.log("I got a handle to the video using Wistia's onReady method!", video.uuid);
}});
What is it about using $window._wq
that ends up executing the onReady
method multiple times?
How can we make this code Angular friendly (without "hacking" or forcing a work-around) so that onReady
only fires once when revisiting the controller view each time?
I put up some sample code that can be used to reproduce the issue locally here, if you so choose.
Any insights, thoughts, ideas would be greatly appreciated!!