Skip to content

Commit 953584e

Browse files
Fixes #221
_addToLoadList needs to be called with ‘real’ when called from inject if the actual module has been created by a different loader.
1 parent dfefe84 commit 953584e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/ocLazyLoad.core.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,19 +586,20 @@
586586
* Inject new modules into Angular
587587
* @param moduleName
588588
* @param localParams
589+
* @param real
589590
*/
590-
inject: function(moduleName, localParams = {}) {
591+
inject: function(moduleName, localParams = {}, real = false) {
591592
var self = this,
592593
deferred = $q.defer();
593594
if(angular.isDefined(moduleName) && moduleName !== null) {
594595
if(angular.isArray(moduleName)) {
595596
var promisesList = [];
596597
angular.forEach(moduleName, module => {
597-
promisesList.push(self.inject(module));
598+
promisesList.push(self.inject(moduleName, localParams, real));
598599
});
599600
return $q.all(promisesList);
600601
} else {
601-
self._addToLoadList(self._getModuleName(moduleName), true);
602+
self._addToLoadList(self._getModuleName(moduleName), true, real);
602603
}
603604
}
604605
if(modulesToLoad.length > 0) {

src/ocLazyLoad.loaders.core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202

203203
// if someone used an external loader and called the load function with just the module name
204204
if(angular.isUndefined(config.files) && angular.isDefined(config.name) && $delegate.moduleExists(config.name)) {
205-
return $delegate.inject(config.name, localParams);
205+
return $delegate.inject(config.name, localParams, true);
206206
}
207207

208208
$delegate.filesLoader(config, localParams).then(() => {

0 commit comments

Comments
 (0)