[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ X] Support request
error in browser console:
Unhandled Promise rejection: No provider for Actions! ; Zone: <root> ; Task: Promise.then ; Value: Error: No provider for Actions!
It works
// AuthenticationEffects.ts
import { Actions, Effect, toPayload } from '@ngrx/effects'
@Injectable()
export class AuthenticationEffects {
consructor(private actions$: Actions, private authService: AuthenticationService) {}
@Effect() login$: Observable<Action> = this.actions$
...
}
// app.module.ts
import { EffectsModule } from '@ngrx/effects
import { StoreModule } from '@ngrx/store
import { AuthenticationEffects } from './AuthenticationEffects'
@NgModule {
imports: [
BrowserModule,
HttpModule,
BrowserAnimationsModule,
FormsModule,
RouterModule.forRoot(routes),
EffectsModule.forRoot([AuthenticationEffects]),
StoreModule.forRoot({ reducer: reducer }),
MdComponentsModule,
],
}
export class AppModule {}
ngrx/store 4.0.0
ngrx/effects 4.01
angular 4.1.3
rxjs 5.4.1
zone.js 0.8.14
I have left out parts of the code that I felt were superfluous. If you need anything further I will do my best to provide without a wall of code.
:heartpulse: ngrx? Please consider supporting our collective: 馃憠 donate
You need to do StoreModule.forRoot before you do EffectsModule - I think there's already a bug for it. 184
Closed as duplicate of #184
so huge efforts just to bootstrap properly effects with ngUpgrade, looks not very natural.
Just as a notice for newcomers: https://ngrx.io/guide/effects
鈿狅笍 The
EffectsModule.forRoot()method must be added to yourAppModuleimports even if you don't register any root-level effects.
I confirm EffectsModule.forRoot([]) in the appModule worked just fine :)
Most helpful comment
Just as a notice for newcomers: https://ngrx.io/guide/effects