Adding modules in angular-meteor

73 views Asked by At

I'm developing a web app with angular-meteor (Angular1). This uses webpack as a module bundler. Ever since I started I have found it impossible to inject npm/bower modules to my app module.

I constantly get errors such as:

Error: [$injector:nomod] Module xxx is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

I usually follow official docs which consist of:

  • Downloading the npm module
  • Including the scripts in my index.html
  • Adding the module to my app module

But this always gives the error above.

I then try different techniques such as importing the module at the top of the page using:

import exampleModule from 'angular-example-module';

and adding exampleModule to my list of modules but nothing seems to work.

I used angular without webpack before and never had this problem. Am I missing something? Is there a particular procedure I don't know about?

1

There are 1 answers

0
Charles Desbaux On BEST ANSWER

Found the answer in case anyone else had the same question.

You must import the module in the main javascript file like so:

import moduleVariable from '<path-to-module>';

and then include the moduleVariable in the dependencies of your application module.