Trying to migrate to ionicPush but getting errors anyway I do it:
When I put $ionicPush.init as per guide in the app.js or anywhere for that matter, getting:
Uncaught TypeError: $ionicPush.init is not a function
When I check $ionicPush it has 2 methods, register and unregister. So clearly it gets imported, but for whatever reason doesnt have .init
Top of app.js looks like this:
.run(function(AppRootService, $ionicPlatform, $ionicPush, $cordovaSplashscreen,$window, $timeout) {
    $ionicPlatform.ready(function() {
    $ionicPush.init({
        "debug": true,
        "onNotification": function(notification) {
            var payload = notification.payload;
            console.log(notification, payload);
              },
        "onRegister": function(data) {
            console.log(data.token);
              }
        });
    $ionicPush.register();
Put this code in app.js after $ionicPlatform.ready()
var push = new Ionic.Push({
          "debug": true,
          "onNotification": function(notification) {
            var payload = notification.payload;
            console.log(notification, payload);
          },
          "onRegister": function(data) {
            console.log(data.token);
          }
        });
        push.register(function(token) {
          console.log("Device token:",token.token);
        });
        Ionic.io();
Still nothing, this time error is Uncaught ReferenceError: Ionic is not defined
Ran both of these:
ionic add ionic-platform-web-client
ionic plugin add phonegap-plugin-push
Moved around Ionic.io(), not luck
I think you have to init io and activate debug/dev mode.
Here is the all steps...
ionic add ionic-platform-web-client
ionic plugin add phonegap-plugin-push
ionic io init
ionic config set dev_push true
.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    var push = new Ionic.Push({
      "debug": true
    });
    push.register(function(token) {
      console.log("Device token:",token.token);
    });
  });
})
Checkout this page for setting up push for platforms (iOS, Android) http://docs.ionic.io/docs/push-from-scratch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With