7

I am using Webstorm IDE for an AngularJS project.

I have added AngularJS to the librairies and autocompletion etc. works just fine.

However, Webstorm IDE does not find the function angular.module() which is quite central. I have tried everything (reinstalling, etc.) but it still does not seem to work.

Any ideas what it could be?

  • 1
    Apparently it's a bug in WebStorm11 IDE [Link to ticket](https://youtrack.jetbrains.com/issue/WEB-18924) –  Nov 09 '15 at 16:11
  • Totally ridiculous that JetBrains hasn't resolved this. It's like if the someobj.prototype wasn't recognized. Jeez. – MaxRocket Feb 01 '16 at 21:18

3 Answers3

15

To date there has been no progress on the WebStorm IDS ticket referenced above by @AllYouCanEat86 so I am not sure if it should be fixed without adding libraries to WebStorm. Once I followed the advice given in this answer my issue was resolved and no longer got the warning in WebStorm.

In short go to File > Settings > Languages & Frameworks > JavaScript > Libraries and download angular (used to be called angularjs) from the community stubs. It appears in the list as angularjs-DefinitelyTyped once it has been downloaded.

Community
  • 1
  • 1
Precastic
  • 3,742
  • 1
  • 24
  • 29
1

I don't have the reputation to reply to a comment yet, but @Precastic's solution worked for me using Webstorm 9. Note that the library name is "angular", not "angularjs", however.

To be clear, that solution was:

In short go to File > Settings > Languages & Frameworks > JavaScript > Libraries and download angular from the community stubs. It appears in the list as angular-DefinitelyTyped once it has been downloaded.

Josh
  • 321
  • 2
  • 15
0

I had the same problem, and the only solution was to include AngularJS using a CDN as instructed on the Jetbrains blog.

You include the script tag like this:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>

And follow the instructions below:

If you prefer to use a CDN, place the cursor over the highlight library name, hit Alt+Enter, and Download Library. This will set up a local library in WebStorm’s cache (not in your project) so WebStorm can access AngularJS methods, directives, etc for autocompletion and documentation lookup.

Gabriel Rohden
  • 1,307
  • 9
  • 19