Reputation: 361
I was modifying the existing project to implement the redux implementation. Made the code changes, and found the below error while compiling. According to the learning material I have referred, ngRedux need not be added into the providers. Upon adding it to the providers, still getting error.
**AppModule.ts**
//Activation of store.
import {NgRedux , NgReduxModule} from '@angular-redux/store';
import {IAppState,INITIAL_STATE,rootReducer} from '../store';
//Other Imports here
@NgModule({
declarations: [
AppComponent,
ViewallComponent,
WorkoutComponent,
CategoryComponent,
TrackComponent,
TestComponent,
CategoryPipe,
ActiveworkoutComponent,
WorkoutPipe,
],
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
FusionChartsModule.forRoot(FusionCharts, Charts, FintTheme)
],
providers: [
WorkoutService,
CategoryService,
ActiveworkoutService
],
bootstrap: [AppComponent]
})
export class AppModule {
constructor (ngRedux: NgRedux<IAppState>) {
ngRedux.configureStore(rootReducer, INITIAL_STATE);
}
}
Had made appropriate changes in component , and made the store files.
Error:
Error: StaticInjectorError(AppModule)[AppModule -> NgRedux]:
StaticInjectorError(Platform: core)[AppModule -> NgRedux]:
NullInjectorError: No provider for NgRedux!
Stack trace:
./node_modules/@angular/core/fesm5/core.js/NullInjector.prototype.get@http://localhost:4200/vendor.js:33896:19
resolveToken@http://localhost:4200/vendor.js:34133:17
tryResolveToken@http://localhost:4200/vendor.js:34077:16
./node_modules/@angular/core/fesm5/core.js/StaticInjector.prototype.get@http://localhost:4200/vendor.js:33974:20
resolveToken@http://localhost:4200/vendor.js:34133:17
tryResolveToken@http://localhost:4200/vendor.js:34077:16`enter code here`
Upvotes: 1
Views: 2181
Reputation: 222532
You need to add NgReduxModule
under imports of module.ts
imports: [
NgReduxModule
]
Upvotes: 2