Integrate service with app

This commit is contained in:
Ben Goldsworthy 2020-11-08 17:38:49 +00:00
parent 55a3f43f6c
commit 59de678e3f
2 changed files with 23 additions and 1 deletions

View file

@ -1,7 +1,19 @@
import { Component } from '@angular/core';
import { MessagingService } from './service/messaging.service';
@Component({
selector: 'app-root',
template: '<router-outlet></router-outlet>'
})
export class AppComponent { }
export class AppComponent {
title = 'push-notification';
message;
constructor(private messagingService: MessagingService) { }
ngOnInit() {
this.messagingService.requestPermission();
this.messagingService.receiveMessage();
this.message = this.messagingService.currentMessage;
}
}

View file

@ -23,6 +23,11 @@ import { OrgGuard } from './_guards/org.guard';
import { CustomerGuard } from './_guards/customer.guard';
import { ApiService } from './providers/api-service';
import { AngularFireMessagingModule } from '@angular/fire/messaging';
import { AngularFireModule } from '@angular/fire';
import { MessagingService } from './service/messaging.service';
import { AsyncPipe } from '../../node_modules/@angular/common';
import { OrgGraphsService } from './providers/org-graphs.service';
import { CustGraphsService } from './providers/cust-graphs.service';
import { OrgSnippetsService } from './providers/org-snippets.service';
@ -51,6 +56,8 @@ import { FilterPipeModule } from 'ngx-filter-pipe';
BrowserModule,
HttpClientModule,
FormsModule,
AngularFireMessagingModule,
AngularFireModule.initializeApp(environment.firebase),
FilterPipeModule,
ReactiveFormsModule,
NgxPaginationModule,
@ -76,6 +83,8 @@ import { FilterPipeModule } from 'ngx-filter-pipe';
],
providers: [
AuthGuard,
MessagingService,
AsyncPipe,
OrgGuard,
CustomerGuard,
ApiService,
@ -92,6 +101,7 @@ import { FilterPipeModule } from 'ngx-filter-pipe';
],
bootstrap: [ AppComponent ]
})
export class AppModule {
constructor () {
if (environment.enableAnalytics) {