angular-routing

Angular 4 Multiple Guards - Execution Sequence

时光毁灭记忆、已成空白 提交于 2020-08-27 01:34:41
问题 I have 2 guards, AuthGuard and AccessGuard in the application. AuthGuard protects all the pages as the name suggests and stores the session object in the GlobalService and AccessGuard depends on the some access data in session object stored by AuthGuard in GlobalService. Problem arises when AuthGuard returns an Observable and then simultaneously AccessGuard executes to check for session object which has not yet arrived and the code breaks. Is there any other way I can restrict the execution

RouterModule.forRoot called twice

有些话、适合烂在心里 提交于 2020-08-03 12:06:30
问题 I am trying to implement Lazy Loading into my application but seem to be coming across an issue whereby I get the error message : Error: RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead. So I have my main app-routing.module.ts and also app-module.ts which looks like below: app-module.ts // External Dependencies import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { HttpClientModule } from