Angularjs 从弹出窗口eventListener处理承诺

Angularjs 从弹出窗口eventListener处理承诺,angularjs,popup,ionic-framework,addeventlistener,angular-promise,Angularjs,Popup,Ionic Framework,Addeventlistener,Angular Promise,我想处理来自“loadstop”eventListener的回调承诺。我已经尝试了一些事情,但当我尝试访问承诺时,我仍然从Angular得到“未定义”。这可能吗 win = window.open(login_url, '_blank', 'location=no,toolbar=no'); // // Since Cordova does not support window to window messaging, we need to use

我想处理来自“loadstop”eventListener的回调承诺。我已经尝试了一些事情,但当我尝试访问承诺时,我仍然从Angular得到“未定义”。这可能吗

        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);
        });

我尝试了各种方法,使用$on/$emit/$broadcast和$watch,但似乎没有任何东西能正常工作。我希望在内部跟踪回调何时完成其工作,并对封装承诺作出反应。