尝试实施ngrx store-devtools时未处理的Promise拒绝

时间:2018-11-03 21:04:01

标签: angular ionic-framework ngrx

我正在尝试将开发工具与ngrx存储一起使用。将它们添加到app.module时,出现以下错误:

Unhandled Promise rejection: Object(...) is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Object(...) is not a function
at new StoreDevtools (store-devtools.js:640)

current version of ngrx已安装。这是app.module.ts:

@NgModule({
  declarations: [...],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    StoreModule.forRoot(reducers),
    StoreDevtoolsModule.instrument()
  ],
  bootstrap: [IonicApp],
  entryComponents: [...],
  providers: [...]
})
export class AppModule {}

这些是我在app.module.ts中的导入:

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';

import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import {reducers} from "../store";
import {StoreDevtoolsModule} from "@ngrx/store-devtools";
import {StoreModule} from "@ngrx/store";

这是我的减速器文件:

import {ActionReducerMap} from '@ngrx/store';
import {Event} from "../models/event.model";
import {eventReducer} from "./reducer/event.reducer";


export interface State {
  events: Event[];
}

export const reducers: ActionReducerMap<State> = {
  events: eventReducer
};

这是事件减少器(当前什么都没有实现):

import {Event} from "../../models/event.model";

export function eventReducer(state: Event[] = []): Event[] {
      return [];
  }

当前npm版本:6.4.1
当前的离子版本:4.3.0

感谢您的帮助,谢谢!

0 个答案:

没有答案