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

Commit 59c2f17

Browse files
committed
fix(injector): check that modulesToLoad isArray.
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.
1 parent d518a64 commit 59c2f17

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/auto/injector.js

+1
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ function createInjector(modulesToLoad, strictDi) {
718718
// Module Loading
719719
////////////////////////////////////
720720
function loadModules(modulesToLoad) {
721+
assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
721722
var runBlocks = [], moduleFn;
722723
forEach(modulesToLoad, function(module) {
723724
if (loadedModules.get(module)) return;

0 commit comments

Comments
 (0)