ORIGINAL EXCEPTION: TypeError: deps is undefined


#1

Hi All,

I am using Ionic 2 and am trying to make use of its Push Notifications as shown here.

I have created the APP_ID and SENDER_ID by registering on Google Cloud Platform.

I get the following error. Can anyone please give some advise.

Thanks

Error

EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in ./MyApp class MyApp_Host - inline template:0:0
ORIGINAL EXCEPTION: TypeError: deps is undefined
ORIGINAL STACKTRACE:
Push@http://localhost:8100/build/js/app.bundle.js:54405:9

app.ts

import { Component, ViewChild } from '@angular/core';
import { ionicBootstrap, Platform, Nav, Storage, LocalStorage } from 'ionic-angular';
import { StatusBar } from 'ionic-native';
import { SearchJobsPage } from './pages/searchjobs/searchjobs';
import { LoginPage } from './pages/login/login';
import { LogoutPage } from './pages/logout/logout';
import { PersonModel } from './pages/model/personModel';
import { ChatPage } from './pages/chat/chat';
import { UtilityService } from './pages/utils/utilityService';
//import { Push } from 'ionic-native';
import {Push, PushToken, CloudSettings, provideCloud} from '@ionic/cloud-angular';
const cloudSettings: CloudSettings = {
  'core': {
    'app_id': 'xxxxxxxxxxx',
  },
  'push': {
    'sender_id': 'xxxxxxxxxxxxxxxx',
    'pluginConfig': {
      'ios': {
        'badge': true,
        'sound': true
      },
      'android': {
        'iconColor': '#343434'
      }
    }
  }
};
@Component({
  templateUrl: 'build/app.html',
  providers: [UtilityService, Push]
})
class MyApp {
  @ViewChild(Nav) nav: Nav;
  rootPage: any = SearchJobsPage;
  private local: Storage = null;
  private pages: Array<{ title: string, component: any }>;
  private pages_person: Array<{ title: string, component: any }>;
  private menuTitle: string = 'Menu';
  private personModel: PersonModel = null;
  private utilityService: UtilityService = null;
  private push: Push = null;
  constructor(private platform: Platform, utilityService: UtilityService, push: Push) {
    this.local = new Storage(LocalStorage);
    this.utilityService = utilityService;
    this.push = push;
    this.initializeApp();
    // used for an example of ngFor and navigation
    this.pages = [
      { title: 'Search', component: SearchJobsPage },
      { title: 'Login', component: LoginPage }
    ];
    this.pages_person = [
      { title: 'Search', component: SearchJobsPage },
      { title: 'Logout', component: LogoutPage }
    ];
  }
  initializeApp() {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
      this.pushNotifications();
    });
  }
  openPage(page) {
    // Reset the content nav to have just this page
    // we wouldn't want the back button to show in this scenario
    this.nav.setRoot(page.component);
  }
  pushNotifications(): void {
    this.push.register().then((t: PushToken) => {
      return this.push.saveToken(t);
    }).then((t: PushToken) => {
      console.log('Token saved:', t.token);
    });
    this.push.rx.notification()
      .subscribe((msg) => {
        alert(msg.title + ': ' + msg.text);
      });
  }
}
ionicBootstrap(MyApp);

#2

Waiting for the ans.
Please help, Unable to understand the error in 2017. :cry::cry:
Email : kadam.virajkadam@gmail.com

Thank you in advance.

Regards,
Viraj Kadam. [ TheViraj.com ]