FarmMapsLib/src/app/app.module.ts

65 lines
1.6 KiB
TypeScript
Raw Normal View History

2019-07-16 14:15:40 +00:00
import {
NgModule,
Inject,
APP_BOOTSTRAP_LISTENER,
InjectionToken, Type,
} from '@angular/core';
2019-06-26 12:35:47 +00:00
import { BrowserModule } from '@angular/platform-browser';
2019-11-04 17:47:15 +00:00
import { AppCommonModule, } from '@farmmaps/common';
2019-11-01 14:57:50 +00:00
import { AppCommonMapModule} from '@farmmaps/common-map';
2019-07-16 14:15:40 +00:00
2019-11-04 17:47:15 +00:00
import {AppRootComponent} from './app.component';
2019-07-16 14:15:40 +00:00
import {StoreModule, Store} from '@ngrx/store';
import {EffectsModule, EffectSources} from '@ngrx/effects';
import { StoreRouterConnectingModule} from '@ngrx/router-store';
import {AppRoutingModule} from './app-routing.module';
2019-11-05 16:19:33 +00:00
import { LogoComponent } from './logo/logo.component';
import { MenuComponent } from './menu/menu.component';
2019-07-16 14:15:40 +00:00
export const BOOTSTRAP_EFFECTS = new InjectionToken('Bootstrap Effects');
export function bootstrapEffects(effects: Type<any>[], sources: EffectSources) {
return () => {
effects.forEach(effect => sources.addEffects(effect));
};
}
export function createInstances(...instances: any[]) {
return instances;
}
export function provideBootstrapEffects(effects: Type<any>[]) {
return [
effects,
{provide: BOOTSTRAP_EFFECTS, deps: effects, useFactory: createInstances},
{
provide: APP_BOOTSTRAP_LISTENER,
multi: true,
useFactory: bootstrapEffects,
deps: [[new Inject(BOOTSTRAP_EFFECTS)], EffectSources],
},
];
}
2019-06-26 12:35:47 +00:00
@NgModule({
declarations: [
2019-11-05 16:19:33 +00:00
AppRootComponent,
LogoComponent,
MenuComponent
2019-06-26 12:35:47 +00:00
],
imports: [
2019-07-16 14:15:40 +00:00
AppRoutingModule,
AppCommonModule.forRoot() ,
2019-11-01 14:57:50 +00:00
AppCommonMapModule.forRoot(),
BrowserModule,
2019-07-16 14:15:40 +00:00
StoreModule.forRoot({}),
EffectsModule.forRoot([])
2019-06-26 12:35:47 +00:00
],
providers: [],
2019-11-04 17:47:15 +00:00
bootstrap: [AppRootComponent]
2019-06-26 12:35:47 +00:00
})
export class AppModule { }