[英]The reduce function causing errors
The errors shown in the chrome console: 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: *I cant find the aproppiate types for something1 return value's type and state type. reducer.ts:*我找不到用于某值返回值的类型和状态类型的适当类型。
import { Action} from '@ngrx/store';
export const something1 = (state: any = {}, action:Action) => {
switch (action.type) {
default:
return state;
}
};
main.ts: Removing "provideStore({something1})" will cause the app work 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));
Solved! 解决了!
I changed in systemjs.config.js inside map the value of '@ngrx' from vendor/@ngrx to 'node_modules/@ngrx'. 我在systemjs.config.js中进行了更改,将“ @ngrx”的值从供应商/ @ ngrx映射到“ node_modules / @ ngrx”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.