0

이 플러그인을 사용하고 있습니다 : http://ngcordova.com/docs/plugins/pushNotificationsV5/ cordovaPushV5는 무엇이며 내 장치 토큰을 nodejs 서버로 보내려고합니다.ngCordova 오류가 계속 발생합니다

angular.module('starter', ['ionic', 'ngCordova']) 
 

 
.run(function($http, $cordovaPushV5) { 
 

 
    var options = { 
 
    \t android: { 
 
    \t senderID: "12345679" 
 
    \t }, 
 
    ios: { 
 
     alert: "true", 
 
     badge: "true", 
 
     sound: "true" 
 
    }, 
 
    windows: {} 
 
    }; 
 
    
 
    // initialize 
 
    $cordovaPushV5.initialize(options).then(function() { 
 
    // start listening for new notifications 
 
    $cordovaPushV5.onNotification(); 
 
    // start listening for errors 
 
    $cordovaPushV5.onError(); 
 
    
 
    // register to get registrationId 
 
    $cordovaPushV5.register().then(function(data) { 
 
     // `data.registrationId` save it somewhere; 
 
    }) 
 
    }); 
 
    
 
    // triggered every time notification received 
 
    $rootScope.$on('$cordovaPushV5:notificationReceived', function(event, data){ 
 
    // data.message, 
 
    // data.title, 
 
    // data.count, 
 
    // data.sound, 
 
    // data.image, 
 
    // data.additionalData 
 
    }); 
 

 
    // triggered every time error occurs 
 
    $rootScope.$on('$cordovaPushV5:errorOcurred', function(event, e){ 
 
    // e.message 
 
    }); 
 

 
});
<html> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
 
    <title></title> 
 

 
    <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
 
    <link href="css/style.css" rel="stylesheet"> 
 

 
    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
 
    <link href="css/ionic.app.css" rel="stylesheet"> 
 
    --> 
 

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

 
    <!-- cordova script (this will be a 404 during development) --> 
 
    <script src="lib/ngCordova/dist/ng-cordova.min.js"></script> 
 
    <script src="cordova.js"></script> 
 

 
    <!-- your app's js --> 
 
    <script src="js/app.js"></script> 
 
    </head> 
 
    <body ng-app="starter"> 
 

 
    <ion-pane> 
 
     <ion-header-bar class="bar-stable"> 
 
     <h1 class="title">Ionic Blank Starter</h1> 
 
     </ion-header-bar> 
 
     <ion-content> 
 
     </ion-content> 
 
    </ion-pane> 
 
    </body> 
 
</html>

내가 그것을 실행하면 이온 성 역할 (브라우저) 내가이 콘솔 오류 얻을 : 오류 ReferenceError : 변수를 찾을 수 없습니다 PushNotification를

사람이 알고 있나요 여기 내 코드입니다 이게 무슨 뜻이야?

+0

브라우저에서 해당 모듈을 실행할 수 없습니다. 장치에서 실행해야합니다. –

답변

0

위의 설명은 100 % 맞습니다. 이 오류는 브라우저에서만 표시됩니다.

관련 문제