Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(injector): check that modulesToLoad isArray.
Browse files Browse the repository at this point in the history
When users accidentally just pass a single string, e.g.
`angular.injector('myModule')`, this change give them a better error message.

Currently Angular just reports that the module with the name 'm' is missing,
as it's iterating through all characters in the string, instead of all strings
in the module.
  • Loading branch information
mprobst committed Jul 7, 2015
1 parent d518a64 commit 59c2f17
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/auto/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ function createInjector(modulesToLoad, strictDi) {
// Module Loading
////////////////////////////////////
function loadModules(modulesToLoad) {
assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
var runBlocks = [], moduleFn;
forEach(modulesToLoad, function(module) {
if (loadedModules.get(module)) return;
Expand Down

0 comments on commit 59c2f17

Please sign in to comment.