Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { AngularFireMessagingModule } from '@angular/fire/messaging';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
NavComponent
],
imports: [
CommonModule,
BrowserModule.withServerTransition({appId: 'my-app'}),
ServiceWorkerModule.register('/ngsw-worker.js', {enabled: environment.production}),
RouterModule.forRoot([
{ path: '', component: HomeComponent, pathMatch: 'full'},
{ path: 'articles/:id', loadChildren: () => import('./article/article.module').then(m => m.ArticleModule)},
{ path: 'authors/:id', loadChildren: () => import('./author/author.module').then(m => m.AuthorModule), ...canActivate(loggedIn)}
], { preloadingStrategy: PreloadAllModules, initialNavigation: 'enabled' }),
AngularFireModule.initializeApp(environment.firebase),
AngularFireAuthModule,
AngularFireDatabaseModule,
AngularFirestoreModule.enablePersistence(),
AngularFireAuthGuardModule,
AngularFirePerformanceModule,
AngularFireMessagingModule
//PrebootModule.withConfig({ appRoot: 'app-root' })
],
bootstrap: [ ],
providers: [
// { provide: EnableStateTransferToken, useValue: true }
]
})
export class AppModule { }
constructor(
private readonly app: FirebaseApp,
private readonly db: AngularFireDatabase,
private readonly auth: AngularFireAuth,
private readonly afStore: AngularFirestore,
private readonly storage: AngularFireStorage,
private readonly messaging: AngularFireMessaging,
private readonly functions: AngularFireFunctions,
private readonly performance: AngularFirePerformance,
private readonly appRef: ApplicationRef
) {
const authArgs = canActivate(loggedIn);
console.log(app, db, auth, afStore, storage, messaging, functions, performance, authArgs);
appRef.isStable.subscribe(it => console.log("isStable", it));
}
}
...canActivate(redirectToLogin)
},
{ path: 'login', loadChildren: './pages/login/login.module#LoginPageModule' },
{
path: 'signup',
loadChildren: './pages/signup/signup.module#SignupPageModule'
},
{
path: 'reset-password',
loadChildren:
'./pages/reset-password/reset-password.module#ResetPasswordPageModule'
},
{
path: 'profile',
loadChildren: './pages/profile/profile.module#ProfilePageModule',
...canActivate(redirectToLogin)
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}