Expand Minimize

Number of injected dependencies matches the number of function parameters in module configs

When injecting dependencies in module configs ensure that they match the function parameters

CheckId NG1010202
TypeName NumberOfInjectedDependenciesMatchesNumberOfFunctionParametersInModuleConfigs
Severity CriticalError
Type Module config

When injecting dependencies in module configs ensure that the specified dependencies match the function parameters. Any additional parameters specified in the function, will be omitted and AngularJS won't assign any dependencies to them.

Bad practice ($locationProvider not specified amongst dependencies to inject)

angular
    .module('app')
    .config(['$routeProvider', function($routeProvider, $locationProvider) {
        // ...
    }]);


Good practice
angular
    .module('app')
    .config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
        // ...
    }]);

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.