Platform: No provider for Actions!

Created on 26 Jul 2017  路  5Comments  路  Source: ngrx/platform

I'm submitting a...


[ ] 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

What is the current behavior?

error in browser console:
Unhandled Promise rejection: No provider for Actions! ; Zone: <root> ; Task: Promise.then ; Value: Error: No provider for Actions!

Expected behavior:


It works

Minimal reproduction of the problem with instructions:

// 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 {}

Version of affected browser(s),operating system(s), npm, node and ngrx:

ngrx/store 4.0.0
ngrx/effects 4.01
angular 4.1.3
rxjs 5.4.1
zone.js 0.8.14

Other information:

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

Most helpful comment

Just as a notice for newcomers: https://ngrx.io/guide/effects

鈿狅笍 The EffectsModule.forRoot() method must be added to your AppModule imports even if you don't register any root-level effects.

All 5 comments

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 your AppModule imports even if you don't register any root-level effects.

I confirm EffectsModule.forRoot([]) in the appModule worked just fine :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hccampos picture hccampos  路  3Comments

shyamal890 picture shyamal890  路  3Comments

doender picture doender  路  3Comments

sandangel picture sandangel  路  3Comments

dmytro-gokun picture dmytro-gokun  路  3Comments