最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Webstorm IDE and AngularJS angular.module unresolved method - Stack Overflow

programmeradmin4浏览0评论

I am using Webstorm IDE for an AngularJS project.

I have added AngularJS to the librairies and autopletion 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?

I am using Webstorm IDE for an AngularJS project.

I have added AngularJS to the librairies and autopletion 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?

Share Improve this question asked Nov 4, 2015 at 16:54 user3370602user3370602 2
  • 1 Apparently it's a bug in WebStorm11 IDE Link to ticket – user3370602 Commented Nov 9, 2015 at 16:11
  • Totally ridiculous that JetBrains hasn't resolved this. It's like if the someobj.prototype wasn't recognized. Jeez. – MaxRocket Commented Feb 1, 2016 at 21:18
Add a ment  | 

3 Answers 3

Reset to default 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 munity stubs. It appears in the list as angularjs-DefinitelyTyped once it has been downloaded.

I don't have the reputation to reply to a ment 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 munity stubs. It appears in the list as angular-DefinitelyTyped once it has been downloaded.

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./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 autopletion and documentation lookup.

发布评论

评论列表(0)

  1. 暂无评论