dist/ocLazyLoad.require.js
function inject(moduleName) {
                    var localParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
                    var real = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];

                    var self = this,
                        deferred = $q.defer();
                    if (angular.isDefined(moduleName) && moduleName !== null) {
                        if (angular.isArray(moduleName)) {
                            var promisesList = [];
                            angular.forEach(moduleName, function (module) {
                                promisesList.push(self.inject(module, localParams, real));
                            });
                            return $q.all(promisesList);
                        } else {
                            self._addToLoadList(self._getModuleName(moduleName), true, real);
                        }
                    }
                    if (modulesToLoad.length > 0) {
                        var res = modulesToLoad.slice(); // clean copy
                        var loadNext = function loadNext(moduleName) {
                            moduleCache.push(moduleName);
                            modulePromises[moduleName] = deferred.promise;
                            self._loadDependencies(moduleName, localParams).then(function success() {
                                try {
                                    justLoaded = [];
                                    _register(providers, moduleCache, localParams);
                                } catch (e) {
                                    self._$log.error(e.message);
                                    deferred.reject(e);
                                    return;
                                }

                                if (modulesToLoad.length > 0) {
                                    loadNext(modulesToLoad.shift()); // load the next in list
                                } else {
                                        deferred.resolve(res); // everything has been loaded, resolve
                                    }
                            }, function error(err) {
                                deferred.reject(err);
                            });
                        };

                        // load the first in list
                        loadNext(modulesToLoad.shift());
                    } else if (localParams && localParams.name && modulePromises[localParams.name]) {
                        return modulePromises[localParams.name];
                    } else {
                        deferred.resolve();
                    }
                    return deferred.promise;
                }
function inject(moduleName) {
                    var localParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
                    var real = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];

                    var self = this,
                        deferred = $q.defer();
                    if (angular.isDefined(moduleName) && moduleName !== null) {
                        if (angular.isArray(moduleName)) {
                            var promisesList = [];
                            angular.forEach(moduleName, function (module) {
                                promisesList.push(self.inject(module, localParams, real));
                            });
                            return $q.all(promisesList);
                        } else {
                            self._addToLoadList(self._getModuleName(moduleName), true, real);
                        }
                    }
                    if (modulesToLoad.length > 0) {
                        var res = modulesToLoad.slice(); // clean copy
                        var loadNext = function loadNext(moduleName) {
                            moduleCache.push(moduleName);
                            modulePromises[moduleName] = deferred.promise;
                            self._loadDependencies(moduleName, localParams).then(function success() {
                                try {
                                    justLoaded = [];
                                    _register(providers, moduleCache, localParams);
                                } catch (e) {
                                    self._$log.error(e.message);
                                    deferred.reject(e);
                                    return;
                                }

                                if (modulesToLoad.length > 0) {
                                    loadNext(modulesToLoad.shift()); // load the next in list
                                } else {
                                        deferred.resolve(res); // everything has been loaded, resolve
                                    }
                            }, function error(err) {
                                deferred.reject(err);
                            });
                        };

                        // load the first in list
                        loadNext(modulesToLoad.shift());
                    } else if (localParams && localParams.name && modulePromises[localParams.name]) {
                        return modulePromises[localParams.name];
                    } else {
                        deferred.resolve();
                    }
                    return deferred.promise;
                }
function inject ( moduleName ) { var localParams = arguments . length <= 1 || arguments [ 1 ] === undefined ? { } : arguments [ 1 ] ; var real = arguments . length <= 2 || arguments [ 2 ] === undefined ? false : arguments [ 2 ] ; var self = this , deferred = $q . defer ( ) ; if ( angular . isDefined ( moduleName ) && moduleName !== null ) { if ( angular . isArray ( moduleName ) ) { var promisesList = [ ] ; angular . forEach ( moduleName , function ( module ) { promisesList . push ( self . inject ( module , localParams , real ) ) ; } ) ; return $q . all ( promisesList ) ; } else { self . _addToLoadList ( self . _getModuleName ( moduleName ) , true , real ) ; } } if ( modulesToLoad . length > 0 ) { var res = modulesToLoad . slice ( ) ; // clean copy var loadNext = function loadNext ( moduleName ) { moduleCache . push ( moduleName ) ; modulePromises [ moduleName ] = deferred . promise ; self . _loadDependencies ( moduleName , localParams ) . then ( function success ( ) { try { justLoaded = [ ] ; _register ( providers , moduleCache , localParams ) ; } catch ( e ) { self . _$log . error ( e . message ) ; deferred . reject ( e ) ; return ; } if ( modulesToLoad . length > 0 ) { loadNext ( modulesToLoad . shift ( ) ) ; // load the next in list } else { deferred . resolve ( res ) ; // everything has been loaded, resolve } } , function error ( err ) { deferred . reject ( err ) ; } ) ; } ; // load the first in list loadNext ( modulesToLoad . shift ( ) ) ; } else if ( localParams && localParams . name && modulePromises [ localParams . name ] ) { return modulePromises [ localParams . name ] ; } else { deferred . resolve ( ) ; } return deferred . promise ; }
Inject new modules into Angular
@param moduleName
@param localParams
@param real
Inject new modules into Angular