Why do AngularJS directives (attributes, etc.) show up as “invalid” in WebStorm 8?

前端 未结 4 1303
时光说笑
时光说笑 2021-02-13 23:42

I just installed WebStorm 8 a couple of hours ago. I\'ve been writing some AngularJS stuff, and I have a rather annoying little problem. The AngularJS plugin seems to work parti

4条回答
  •  Happy的楠姐
    2021-02-14 00:41

    To add Angular JS as a Project library go to

    Preferences > Project Settings > JavaScript > Libraries > Add
    

    and then select the Angular directory to add it.

    I'm on a Mac but windows should be roughly similar.

    You can also do

    ctrl/cmd + shift + a
    

    (go to anywhere) and type libraries to get to the same place.

    Note: I have Angular referenced in my main html file via https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js and the it works without adding it as a library.

    Edit:

    From the Webstorm blog: 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.

提交回复
热议问题