abdul.badru
abdul.badru

Reputation: 531

Angular2 with redux using ng2-redux

I am trying angular2 with redux for the fist time. I am getting an error when trying to bootstrap my main app by injecting NgRedux and NgReduxRouter:

Error loading http://localhost:4200/ng2-redux/index.js as "ng2-redux" from http://localhost:4200/main.js

My main app looks like this:

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]);

What I am doing wrong?

Upvotes: 0

Views: 352

Answers (1)

Darrel
Darrel

Reputation: 376

Are you using SystemJS? When I was trying something similar I needed to help SystemJS find where ng2-redux was by updating my system-config.ts file:

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

Upvotes: 1

Related Questions