Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Use Platform in ngModule

$
0
0

@Slavrixx wrote:

Is there a way to use Platform from @ionic/angular inside the @NgModule

@NgModule({
  declarations: [
    AppComponent
  ],
  entryComponents: [
    TermsComponent,
    ....
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    AppRoutingModule,
    ServiceWorkerModule.register('OneSignalSDKWorker.js', { enabled: platform.is('pwa') }),
    AngularFireModule.initializeApp(environment.firebase),
    AngularFireStorageModule,
    ...
  ],
  providers: [
    {provide: ErrorHandler, useClass: environment.production ? SentryErrorHandler : ErrorHandler}
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor(public platform: Platform) {
    console.log('plat: ', this.platform.is('android'));
  }
}

I only want the service worker module to be active on PWA, not on hybrid.
Currently an environment variable

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>