|
1 | 1 | /** |
2 | 2 | * oclazyload - Load modules on demand (lazy load) with angularJS |
3 | | - * @version v1.0.5 |
| 3 | + * @version v1.0.6 |
4 | 4 | * @link https://github.com/ocombe/ocLazyLoad |
5 | 5 | * @license MIT |
6 | 6 | * @author Olivier Combe <olivier.combe@gmail.com> |
|
617 | 617 | * Inject new modules into Angular |
618 | 618 | * @param moduleName |
619 | 619 | * @param localParams |
| 620 | + * @param real |
620 | 621 | */ |
621 | 622 | inject: function inject(moduleName) { |
622 | 623 | var localParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; |
| 624 | + var real = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; |
623 | 625 |
|
624 | 626 | var self = this, |
625 | 627 | deferred = $q.defer(); |
626 | 628 | if (angular.isDefined(moduleName) && moduleName !== null) { |
627 | 629 | if (angular.isArray(moduleName)) { |
628 | 630 | var promisesList = []; |
629 | 631 | angular.forEach(moduleName, function (module) { |
630 | | - promisesList.push(self.inject(module)); |
| 632 | + promisesList.push(self.inject(moduleName, localParams, real)); |
631 | 633 | }); |
632 | 634 | return $q.all(promisesList); |
633 | 635 | } else { |
634 | | - self._addToLoadList(self._getModuleName(moduleName), true); |
| 636 | + self._addToLoadList(self._getModuleName(moduleName), true, real); |
635 | 637 | } |
636 | 638 | } |
637 | 639 | if (modulesToLoad.length > 0) { |
|
1123 | 1125 |
|
1124 | 1126 | // if someone used an external loader and called the load function with just the module name |
1125 | 1127 | if (angular.isUndefined(config.files) && angular.isDefined(config.name) && $delegate.moduleExists(config.name)) { |
1126 | | - return $delegate.inject(config.name, localParams); |
| 1128 | + return $delegate.inject(config.name, localParams, true); |
1127 | 1129 | } |
1128 | 1130 |
|
1129 | 1131 | $delegate.filesLoader(config, localParams).then(function () { |
|
0 commit comments