8 | Welcome to Ionic!
9 |
10 | This starter project comes with simple tabs-based layout for apps
11 | that are going to primarily use a Tabbed UI.
12 |
13 |
14 | Take a look at the src/pages/
directory to add or change tabs,
15 | update any existing page or create new pages.
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/pages/home/home.scss:
--------------------------------------------------------------------------------
1 | page-home {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/src/pages/home/home.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 | import { NavController } from 'ionic-angular';
3 | import { FcmProvider } from '../../providers/fcm/fcm';
4 |
5 | import { ToastController } from 'ionic-angular';
6 | import { Subject } from 'rxjs/Subject';
7 | import { tap } from 'rxjs/operators';
8 |
9 | @Component({
10 | selector: 'page-home',
11 | templateUrl: 'home.html'
12 | })
13 | export class HomePage {
14 |
15 | constructor(public fcm: FcmProvider, public toastCtrl: ToastController) {}
16 |
17 | ionViewDidLoad(){
18 |
19 | // Get a FCM token
20 | this.fcm.getToken()
21 |
22 | this.fcm.listenToNotifications().pipe(
23 | tap(msg => {
24 | const toast = this.toastCtrl.create({
25 | message: msg.body,
26 | duration: 3000
27 | });
28 | toast.present();
29 | })
30 | )
31 | .subscribe()
32 | }
33 |
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/pages/tabs/tabs.html:
--------------------------------------------------------------------------------
1 |