2016-08-06 43 views
0

我正在尝试angular2与第一次使用redux。Angular2与使用ng2-redux的redux

错误加载http://localhost:4200/ng2-redux/index.jshttp://localhost:4200/main.js

“NG2-终极版”我的主要的应用程序是这样的:

试图通过注入NgRedux和NgReduxRouter来引导我主要的应用程序时,我得到一个错误

import { bootstrap } from '@angular/platform-browser-dynamic'; 
 
import { enableProdMode } from '@angular/core'; 
 
import { HTTP_PROVIDERS } from '@angular/http'; 
 

 
import { AppComponent, environment } from './app/'; 
 
import { appRouterProviders } from './app/app.routes'; 
 
import {UserService} from './app/services/user.service'; 
 
import {NgRedux} from "ng2-redux"; 
 
import {NgReduxRouter} from "ng2-redux-router"; 
 
import {ACTION_PROVIDERS} from "./app/actions/index"; 
 
import {EPIC_PROVIDERS} from "./app/epics/index"; 
 

 
if (environment.production) { 
 
    enableProdMode(); 
 
} 
 

 

 
bootstrap(AppComponent,[NgRedux, NgReduxRouter, ACTION_PROVIDERS,EPIC_PROVIDERS,appRouterProviders, UserService, HTTP_PROVIDERS]);

我做错了吗?

回答

1

你在使用SystemJS吗?当我尝试类似的东西时,我需要通过更新我的system-config.ts文件来帮助SystemJS找到ng2-redux的位置:

System.config({ 
    map: { 
    ... 
    'ng2-redux': 'node_modules/ng2-redux', 
    'redux': 'node_modules/redux' 
    }, 
    ... 
})