2016-09-27 84 views
1

我這篇文章如下:Ionic Push Notification Guide離子不離子定義v2的推送通知

但這樣做的所有步驟後,我一直在的app.js的下一行得到一個「離子沒有定義」我離子應用:

var push = new Ionic.Push({ 
    "debug": true 
}); 

我不知道爲什麼會這樣,但是這是我的angular.module.run功能齊全的在這個問題上更深入的瞭解:

.run(function($ionicPlatform) { 
    $ionicPlatform.ready(function() { 
    if (window.cordova && window.cordova.plugins.Keyboard) { 
     cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 
     cordova.plugins.Keyboard.disableScroll(true); 
    } 
    if (window.StatusBar) { 
     StatusBar.styleDefault(); 
    } 
    var push = new Ionic.Push({ 
     "debug": true 
    }); 
    push.register(function(token) { 
     console.log("My Device token:",token.token); 
     push.saveToken(token); 
    }); 
    }); 
}) 

請告訴我任何額外的信息,我可以提供使這個問題更清楚。

回答

1

試試這個:

在index.html文件只需添加以下行後

<script src="lib/ionic/ionic.bundle.js"></script> 

<script src="lib/ionic-platform-web-client/dist/ionic.io.bundle.js"></script> 

,並使用此COMAND:ionic config set dev_push true