Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No provider for Actions! #187

Closed
dfmartin opened this issue Jul 26, 2017 · 5 comments
Closed

No provider for Actions! #187

dfmartin opened this issue Jul 26, 2017 · 5 comments

Comments

@dfmartin
Copy link

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.

💗 ngrx? Please consider supporting our collective: 👉 donate

@vgellerman
Copy link

vgellerman commented Jul 26, 2017

You need to do StoreModule.forRoot before you do EffectsModule - I think there's already a bug for it. 184

@brandonroberts
Copy link
Member

Closed as duplicate of #184

@brandonroberts brandonroberts marked this as a duplicate of #184 Jul 26, 2017
@kemins
Copy link

kemins commented Oct 29, 2018

so huge efforts just to bootstrap properly effects with ngUpgrade, looks not very natural.

@joseluisq
Copy link

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.

@TheAngularGuy
Copy link

TheAngularGuy commented Apr 11, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants