In order for an effect to pick up on the action that triggers it being newed up, it has to be looped into scope at the module governoring the component where this.store.select and/or this.store.dispatch gets called. For this example we need this example:
import { NgModule } from '@angular/core';
import { BusinessUnitRecordsComponent } from '../components/business-unit
-records.component';
import { BusinessUnitRecordsAuthenticatedComponent } from '../components/business
-unit-records-authenticated.component';
import { BusinessUnitRecordsUnauthorizedComponent } from '../components/business
-unit-records-unauthorized.component';
import { BusinessUnitRecordsRoutingModule } from './business-unit-records
-routing.module';
import { BusinessUnitRecordsContract } from '../contracts/business-unit
-records.contract';
import { BusinessUnitRecordsService } from '../services/business-unit-records.service';
import { LoggingContract } from '../contracts/logging.contract';
import { LoggingService } from '../services/logging.service';
import { HttpModule } from '@angular/http';
import { CommonModule} from '@angular/common';
import { JumbotronModule } from './jumbotron.module';
import { BusinessUnitRecordEffects } from '../state-management/effects/business-unit
-record.effect';
import { EffectsModule } from '@ngrx/effects';
@NgModule({
declarations: [
BusinessUnitRecordsComponent,
BusinessUnitRecordsAuthenticatedComponent,
BusinessUnitRecordsUnauthorizedComponent
],
imports: [
BusinessUnitRecordsRoutingModule,
CommonModule,
HttpModule,
JumbotronModule,
EffectsModule.forRoot([
BusinessUnitRecordEffects
]),
],
providers: [
BusinessUnitRecordEffects,
{ provide: BusinessUnitRecordsContract, useClass: BusinessUnitRecordsService },
{ provide: LoggingContract, useClass: LoggingService }
],
bootstrap: [BusinessUnitRecordsComponent]
})
export class BusinessUnitRecordsModule { }
No comments:
Post a Comment