Some refactoring
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma
2019-11-05 17:19:33 +01:00
parent 28fabab175
commit 9ebce8e0bb
29 changed files with 306 additions and 91 deletions

View File

@@ -1,5 +1,5 @@
// angular modules
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector } from '@angular/core';
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector,Optional,SkipSelf } from '@angular/core';
import { CommonModule, DatePipe } from '@angular/common';
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
@@ -137,6 +137,12 @@ export {FolderService,
]
})
export class AppCommonModule {
constructor (@Optional() @SkipSelf() parentModule: AppCommonModule) {
if (parentModule) {
throw new Error(
'AppCommonModule is already loaded. Import it in the AppModule only');
}
}
static forRoot(): ModuleWithProviders {
return {
ngModule: AppCommonModule,
@@ -152,19 +158,7 @@ export class AppCommonModule {
provide: HTTP_INTERCEPTORS,
useClass: AccessTokenInterceptor,
multi: true
},
ResumableFileUploadService,
EventService,
FolderService,
UserService,
ItemService,
TypeaheadService,
AuthCallbackGuard,
AuthGuard,
NavBarGuard,
FullScreenGuard,
TimespanService,
ItemTypeService
}
]
};
}