Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

Ionic push error - Cannot read property 'init' of undefined

$
0
0

@eldy wrote:

angular.module('starter.controllers', ['ionic','angular-jwt'])

.controller('AppCtrl',function(){
var push = new Ionic.Push({
              "debug": true
            });

              push.saveToken(obj);
});

I can't register token to device in other controller? my above work when I put it within the run() block like how I followed the official example :

run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    var push = new Ionic.Push({
      "debug": true
    });

    push.register(function(token) {
      console.log("Device token:",token.token);
      push.saveToken(token);  // persist the token in the Ionic Platform
    });
  });
})

But why it isn't working in above case? I got an error of Cannot read property 'init' of undefined

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>