Property 'forRoot' does not exist on type 'typeof NgReduxModule'
I've created a fresh project using angular cli. Tried using ng2-redux in it. But at the very first place I'm getting this error
ERROR in Error encountered resolving symbol values statically. Calling function 'NgReduxModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/parminder/Documents/code/redux-test/src/app/app.module.ts, resolving symbol AppModule in /Users/parminder/Documents/code/redux-test/src/app/app.module.ts
ERROR in ./src/app/app.module.ts
Module build failed: Error: /Users/parminder/Documents/code/redux-test/src/app/app.module.ts (17,19): Property 'forRoot' does not exist on type 'typeof NgReduxModule'.)
at _checkDiagnostics (/Users/parminder/Documents/code/redux-test/node_modules/@ngtools/webpack/src/loader.js:116:15)
at /Users/parminder/Documents/code/redux-test/node_modules/@ngtools/webpack/src/loader.js:141:17
@ ./src/main.ts 5:0-45
@ multi main
Here's the code
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { NgReduxModule, NgRedux } from 'ng2-redux';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
NgReduxModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Straight from the docs, I've been using it. And I'm stuck in this error.
What version of Angular and Ng2 Redux are you using? This API has changed recently
If it's a fresh project you'll likely need [email protected]. Then simply remove the .forRoot() part in your code. See the changelog on the feat/v5 branch for details.
We'll be releasing v5 soon.
I'm using [email protected]. Also, I've tried removing forRoot from there but still I was getting the same error.
Here's a view of my package.json
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
@SethDavenport If I remove forRoot, it gives me this error. ERROR in NgReduxModule is not an NgModule
Hmm - that may be related to this: https://github.com/angular/angular-cli/issues/3426#issuecomment-265277988
Still unclear whether that particular message is an ng2-redux issue or an angular-cli issue. Investigating.
ERROR in NgReduxModule is not an NgModule: fixed in 5.0.0-beta.2.
@SethDavenport i'm still getting the same issue
ERROR in Error encountered resolving symbol values statically. Calling function 'StoreModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /home/touqeer/public_html/podium-client-web/src/app/app.module.ts, resolving symbol AppModule in /home/touqeer/public_html/podium-client-web/src/app/app.module.ts
ERROR in /home/touqeer/public_html/podium-client-web/src/app/app.module.ts (19,17): Property 'forRoot' does not exist on type 'typeof StoreModule'.)
Imports:
imports: [
BrowserModule,
FormsModule,
HttpModule,
StoreModule.forRoot({ user: null }) // <---
],
@touqeershafi Have you figured this out yet? Totally stuck here.
@Yugloocamai np, for time being i've removed this module.