@ehdrei wrote:
import { Component, ViewChild } from '@angular/core'; import { Nav, Platform } from 'ionic-angular'; import { StatusBar } from '@ionic-native/status-bar'; import { SplashScreen } from '@ionic-native/splash-screen'; import { HomePage } from '../pages/home/home'; import { ListPage } from '../pages/list/list'; import { CloudSettings, CloudModule } from '@ionic/cloud-angular'; import { Push, PushToken } from '@ionic/cloud-angular'; @Component({ templateUrl: 'app.html' }) export class MyApp { @ViewChild(Nav) nav: Nav; rootPage: any = HomePage; pages: Array<{title: string, component: any}>; constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, public push: Push ) { this.initializeApp(); // used for an example of ngFor and navigation this.pages = [ { title: 'Home', component: HomePage }, { title: 'List', component: ListPage } ]; } 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. this.statusBar.styleDefault(); this.splashScreen.hide(); this.register(); }); } 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); } register(){ 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); }); } }IONIC FRAMEWORK: 3.3.0
IONIC APP SCRIPTS: 1.3.7
ANGULAR CORE: 4.1.2
ANGULAR COMPILER CLI: 4.1.2
NODE: 7.10.0
OS PLATFORM: MACOS SIERRA
NAVIGATOR PLATFORM: MACINTEL
.......
Posts: 1
Participants: 1