Angularjs 调用window.tapstream.fireEvent时获取错误

Angularjs 调用window.tapstream.fireEvent时获取错误,angularjs,cordova,Angularjs,Cordova,调用window.tapstream.firevent('test-event',false)时出错 错误如下 错误:window.tapstream未定义 @angular.min.js:37:94 我正在使用一页phonegap应用程序,当我更改路线时,控制器会更改,然后生成错误窗口。tapstream在模型中的angulerjs中未定义 app.factory('deviceReady', function(){ return function() { if (ty

调用
window.tapstream.firevent('test-event',false)时出错

错误如下 错误:window.tapstream未定义 @angular.min.js:37:94

我正在使用一页phonegap应用程序,当我更改路线时,控制器会更改,然后生成错误窗口。tapstream在模型中的angulerjs中未定义

app.factory('deviceReady', function(){
    return function() {
        if (typeof window.tapstream === 'object') {
            document.addEventListener('deviceready', function () {
                window.tapstream.create('TAPSTREAM_ACCOUNT_NAME', 'TAPSTREAM_SDK_SECRET', {
                    idfa: '<IDFA goes here>'
                });

            }, false);
        } else {

        }
    };
});
 if (typeof window.tapstream === 'object') {

            window.tapstream.fireEvent('accountCreated-page', false);
        }