从弹出窗口addeventListener处理Promise

时间:2014-11-21 22:27:42

标签: angularjs popup ionic-framework addeventlistener angular-promise

我想处理来自' loadstop'的回复的承诺。事件监听。我尝试了一些事情,但我继续得到"未定义"来自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);
        });

0 个答案:

没有答案