I want to handle the promise of a callback from the 'loadstop' eventListener. I've tried a few things but I continue to get "undefined" from Angular when I try accessing the promise. Is this possible?
win = window.open(login_url, '_blank', 'location=no,toolbar=no');
//
// Since Cordova does not support window to window messaging, we need to use this somewhat hacky method
// to catch the results of the popup window every time the page is done loading.
//
var promise = new $q.promise(_extractBootstrapToken);
win.addEventListener('loadstop', promise);
promise.then(function(bootstrapToken) {
deferred.resolve(bootstrapToken);
});