First try appcommon as library
This commit is contained in:
@@ -1,10 +1,102 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonComponent } from './common.component';
|
||||
// angular modules
|
||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector } from '@angular/core';
|
||||
import { CommonModule, DatePipe } from '@angular/common';
|
||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
// external modules
|
||||
import { OAuthModule,AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
|
||||
import { StoreModule,Store } from '@ngrx/store';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
|
||||
// routing module
|
||||
import { AppCommonRoutingModule } from './common-routing.module';
|
||||
|
||||
import { MODULE_NAME } from './module-name';
|
||||
import * as appCommonReducers from './reducers/app-common.reducer';
|
||||
import * as appCommonEffects from './effects/app-common.effects';
|
||||
|
||||
//components
|
||||
import { FolderService } from './services/folder.service';
|
||||
import { TimespanService} from './services/timespan.service';
|
||||
import { ItemService} from './services/item.service';
|
||||
import { EventService } from './services/event.service';
|
||||
import { TypeaheadService } from './services/typeahead.service';
|
||||
import { UserService } from './services/user.service';
|
||||
import { AppConfig } from './shared/app.config';
|
||||
import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor";
|
||||
import { appConfigFactory } from "./shared/app.config.factory";
|
||||
import { AuthGuard } from './services/auth-guard.service';
|
||||
import { NavBarGuard } from './services/nav-bar-guard.service';
|
||||
import { FullScreenGuard } from './services/full-screen-guard.service';
|
||||
import { SafePipe } from './shared/safe.pipe';
|
||||
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
|
||||
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
|
||||
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
|
||||
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
|
||||
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
|
||||
import { NotFoundComponent } from './components/not-found/not-found.component';
|
||||
import { SidePanelComponent } from './components/side-panel/side-panel.component';
|
||||
import { TimespanComponent } from './components/timespan/timespan.component';
|
||||
import { TagInputComponent } from './components/tag-input/tag-input.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [CommonComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
HttpClientModule,
|
||||
AppCommonRoutingModule,
|
||||
StoreModule.forFeature(MODULE_NAME, appCommonReducers.reducer ),
|
||||
EffectsModule.forFeature([appCommonEffects.AppCommonEffects]),
|
||||
OAuthModule.forRoot(),
|
||||
NgbModule,
|
||||
FormsModule
|
||||
],
|
||||
exports: [CommonComponent]
|
||||
providers: [
|
||||
DatePipe
|
||||
],
|
||||
declarations: [
|
||||
AuthCallbackComponent,
|
||||
SidePanelComponent,
|
||||
SafePipe,
|
||||
NotFoundComponent,
|
||||
ResumableFileUploadComponent,
|
||||
TimespanComponent,
|
||||
TagInputComponent,
|
||||
SessionClearedComponent
|
||||
],
|
||||
exports: [NgbModule, ResumableFileUploadComponent, SidePanelComponent, CommonModule, HttpClientModule, SafePipe, TimespanComponent, TagInputComponent ]
|
||||
})
|
||||
export class CommonModule { }
|
||||
export class AppCommonModule {
|
||||
static forRoot(): ModuleWithProviders {
|
||||
return {
|
||||
ngModule: AppCommonModule,
|
||||
providers: [
|
||||
AppConfig,
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: appConfigFactory,
|
||||
deps: [Injector, AppConfig, OAuthService],
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: AccessTokenInterceptor,
|
||||
multi: true
|
||||
},
|
||||
ResumableFileUploadService,
|
||||
EventService,
|
||||
FolderService,
|
||||
UserService,
|
||||
ItemService,
|
||||
TypeaheadService,
|
||||
AuthCallbackGuard,
|
||||
AuthGuard,
|
||||
NavBarGuard,
|
||||
FullScreenGuard,
|
||||
TimespanService
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user