code: function requireModule(moduleName, callback){
              var deferred = $q.defer();
  
              // Throw Error if Esri is not loaded yet
              if (!isLoaded()) {
                  deferred.reject('Trying to call esriLoader.require(), but the ArcGIS API for JavaScript has not been loaded yet. Run esriLoader.bootstrap() if you are lazy loading the ArcGIS API for JavaScript.');
                  return deferred.promise;
              }
  
              if (typeof moduleName === 'string') {
                  require([moduleName], function (module) {
                      // grab the single module passed back from require callback and send to promise
                      deferred.resolve(module);
                  });
  
                  // return a chained promise that calls the callback function
                  //  to ensure it occurs within the digest cycle
                  return deferred.promise.then(function(module) {
                      if (callback && typeof callback === 'function') {
                          callback(module);
                      }
                      return module;
                  });
              } else if (moduleName instanceof Array) {
                  require(moduleName, function () {
                      var modules = Array.prototype.slice.call(arguments);
                      // grab all of the modules passed back from require callback and send as array to promise
                      deferred.resolve(modules);
                  });
  
                  // return a chained promise that calls the callback function
                  //  to ensure it occurs within the digest cycle
                  return deferred.promise.then(function(modules) {
                      if (callback && typeof callback === 'function') {
                          callback.apply(this, modules);
                      }
                      return modules;
                  });
              } else {
                  deferred.reject('An Array<String> or String is required to load modules.');
                  return deferred.promise;
              }
          }
docs: @ngdoc function
  @name require
  @methodOf esri.core.factory:esriLoader
  
  @description
  Load an Esri module(s) using the Dojo AMD loader.
  
  @param {Array|String} modules  An array of module strings (or a string of a single module) to be loaded.
  @param {Function=} callback An optional function used to support AMD style loading.
  @return {Promise} Returns a $q style promise which is resolved once modules are loaded.