0

I have problems importing ng-redux into my JS client app:

import ngRedux from 'ng-redux';
import needle from 'needle'; // just for debugging

console.log(`Testing: `, {ngRedux, needle});

Output from console is:

Testing: {
    needle: {version: "1.6.0", defaults: ƒ, head: ƒ, get: ƒ, post: ƒ, …},
    ngRedux: "ngRedux"
}

So needle works but ngRedux just returns a string, why?

The folder node_modules/ng-redux looks just fine.

Tom Söderlund
  • 4,743
  • 4
  • 45
  • 67

1 Answers1

1

It returns string, because only thing you need to do is set module as app's dependency, like this:

import ngRedux from 'ng-redux';
angular.module('app', [ngRedux]); // Creating "app" module

If you need to get module, you can write this:

angular.module(ngRedux); // Getting existing "ngRedux" module
karaxuna
  • 26,752
  • 13
  • 82
  • 117
  • Thanks! My challenge is that I'm not running browserify on the entire client app, so I can't use `import` in the `angular.module` code. Can I do something similar to `angular.module('myApp', [window.myBrowserifyBundle.ngRedux]);`? – Tom Söderlund Aug 01 '18 at 09:31