I'm currently working on a project using AngularJS (1.6.5
) in WebStorm. The issue I'm encountering is that WebStorm isn't recognizing the global variables that AngularJS defines. I've made sure to install AngularJS and the correct @types. Additionally, I've included AngularJS as an External library and verified that it's not being excluded by WebStorm. Despite these efforts, WebStorm continues to display errors.
For example:
logConfig.$inject = ["$logProvider", "$compileProvider"];
function logConfig($logProvider: ng.ILogProvider, $compileProvider: ng.ICompileProvider) {
// $logProvider.debugEnabled(false); //TODO add this in production
// $compileProvider.debugInfoEnabled(false); //TODO add this in production
// Disable comment and class directives. Boosts the performance
$compileProvider.commentDirectivesEnabled(false);
$compileProvider.cssClassDirectivesEnabled(false);
}
The code above results in the following error in WebStorm: Unresolved variable $inject
. (the $inject
is highlighted in red and the error message appears when I hover over it)
Is there something I'm overlooking?
Update
I may have identified the issue. WebStorm is not recognizing AngularJS even though it's present in my Node_modules, I have the appropriate typings (@types/angular), and it's been registered as an external library (file-->settings-->languages & frameworks-->JavaScript-->Libraries).
When I attempt to type import * as ng from "an|"
and press "ctrl + space", WebStorm doesn't provide any suggestions related to the angular library. I suspect these issues are interconnected.
Does anyone know of any other solutions to make WebStorm recognize AngularJS?