【问题标题】:The reduce function causing errors导致错误的reduce函数
【发布时间】:2016-11-29 02:32:44
【问题描述】:

chrome控制台显示的错误:

1. http://localhost:3000/vendor/@ngrx/store/index.js
Failed to load resource: the server responded with a status of 404 (Not Found)

2. localhost/:19 Error: Error: XHR error (404 Not Found)
loading http://localhost:3000/vendor/@ngrx/store/index.js(…)
(anonymous function) @ localhost/:19

reducer.ts: *我找不到 something1 返回值的类型和状态类型的适当类型。

import { Action} from '@ngrx/store';
export const something1 = (state: any = {}, action:Action) => {
  switch (action.type) {
    default:
      return state;
  }
};

main.ts:删除“provideStore({something1})”会导致应用正常工作

import { bootstrap }    from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import {AccountService} from "./account.service";
import {provideStore} from '@ngrx/store';
import {something1} from "./reducer";

bootstrap(AppComponent, [
  AccountService,
  disableDeprecatedForms(),
  provideForms(),
  provideStore({something1})
])
  .catch((err: any) => console.error(err));

【问题讨论】:

    标签: javascript angular store rxjs ngrx


    【解决方案1】:

    解决了!

    我在 systemjs.config.js 中将“@ngrx”的值从 vendor/@ngrx 更改为“node_modules/@ngrx”。

    【讨论】:

      猜你喜欢
      • 2020-09-29
      • 1970-01-01
      • 1970-01-01
      • 2016-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-06
      • 2015-04-07
      相关资源
      最近更新 更多