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


#1
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