Angular 4, ngrx\store Plunker - TypeError: store_1.StoreModule.provideStore is not a function
Angular 4, ngrx\store Plunker - TypeError: store_1.StoreModule.provideStore is not a function
我正在尝试创建一个 Angular 4 plunker,其中包括 ngrx\store 最新版本:
https://embed.plnkr.co/cr4rCJ0hRVMwuLzKe4mg/
为了使用 ngrx\store,我在 config.js
文件中添加了这一行:
'@ngrx/store': 'https://npmcdn.com/@ngrx/store@4.0.0',
出于某种原因,我收到此错误:
(SystemJS) TypeError: store_1.StoreModule.provideStore is not a function
有人可以帮忙吗?
在最新版本的 Ngrx 中,provideStore
更改为 forRoot
。
您也可以在这里查看迁移指南https://github.com/ngrx/platform/blob/master/MIGRATION.md
你应该在最新版本的 Angular 中将 'provideStore' 更改为 'forRoot',例如 Angular 6。它对我有用。
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule} from '@angular/forms';
import { UsersServiceService } from './users/users-service.service';
import { PDFGenerationService } from './pdf-generation-demo/pdf-generation.service';
import { AppRoutingModule, routingComponents } from './app-routing.module';
// Import ng-circle-progress
import { NgCircleProgressModule } from 'ng-circle-progress';
import { mainStoreReducer } from './state/reducers/reducer';
import { StoreModule } from '@ngrx/store';
@NgModule({
declarations: [
AppComponent,
routingComponents
],
imports: [
BrowserModule,
HttpClientModule,
FormsModule,
AppRoutingModule,
NgCircleProgressModule.forRoot({
// set defaults here
radius: 100,
outerStrokeWidth: 16,
innerStrokeWidth: 8,
outerStrokeColor: "#78C000",
innerStrokeColor: "#C7E596",
animationDuration: 300
}),
StoreModule.forRoot({ mainStoreReducer })
],
exports: [ ],
providers: [UsersServiceService, PDFGenerationService],
bootstrap: [AppComponent]
})
export class AppModule { }
我正在尝试创建一个 Angular 4 plunker,其中包括 ngrx\store 最新版本: https://embed.plnkr.co/cr4rCJ0hRVMwuLzKe4mg/
为了使用 ngrx\store,我在 config.js
文件中添加了这一行:
'@ngrx/store': 'https://npmcdn.com/@ngrx/store@4.0.0',
出于某种原因,我收到此错误:
(SystemJS) TypeError: store_1.StoreModule.provideStore is not a function
有人可以帮忙吗?
在最新版本的 Ngrx 中,provideStore
更改为 forRoot
。
您也可以在这里查看迁移指南https://github.com/ngrx/platform/blob/master/MIGRATION.md
你应该在最新版本的 Angular 中将 'provideStore' 更改为 'forRoot',例如 Angular 6。它对我有用。
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule} from '@angular/forms';
import { UsersServiceService } from './users/users-service.service';
import { PDFGenerationService } from './pdf-generation-demo/pdf-generation.service';
import { AppRoutingModule, routingComponents } from './app-routing.module';
// Import ng-circle-progress
import { NgCircleProgressModule } from 'ng-circle-progress';
import { mainStoreReducer } from './state/reducers/reducer';
import { StoreModule } from '@ngrx/store';
@NgModule({
declarations: [
AppComponent,
routingComponents
],
imports: [
BrowserModule,
HttpClientModule,
FormsModule,
AppRoutingModule,
NgCircleProgressModule.forRoot({
// set defaults here
radius: 100,
outerStrokeWidth: 16,
innerStrokeWidth: 8,
outerStrokeColor: "#78C000",
innerStrokeColor: "#C7E596",
animationDuration: 300
}),
StoreModule.forRoot({ mainStoreReducer })
],
exports: [ ],
providers: [UsersServiceService, PDFGenerationService],
bootstrap: [AppComponent]
})
export class AppModule { }