src/services/loadable-manager.js
function() {
    var deferred = $q.defer();

    var current = $state.current();

    // Evaluate
    if(current) {
      var sources = (typeof current.load === 'string' ? [current.load] : current.load) || [];
      
      // Get promises
      $q.all(sources
        .map(function(src) {
          return _createLoadable(src);
        })
        .filter(function(loadable) {
          return !loadable.isComplete;
        })
        .map(function(loadable) {
          return loadable.promise;
        })
      )
          .then(function() {
            deferred.resolve();

          }, function(err) {
            $rootScope.$broadcast('$loadableError', err);
            deferred.reject(err);
          });

    // No state
    } else {
      deferred.resolve();
    }

    return deferred.promise;
  }
function() {
    var deferred = $q.defer();

    var current = $state.current();

    // Evaluate
    if(current) {
      var sources = (typeof current.load === 'string' ? [current.load] : current.load) || [];
      
      // Get promises
      $q.all(sources
        .map(function(src) {
          return _createLoadable(src);
        })
        .filter(function(loadable) {
          return !loadable.isComplete;
        })
        .map(function(loadable) {
          return loadable.promise;
        })
      )
          .then(function() {
            deferred.resolve();

          }, function(err) {
            $rootScope.$broadcast('$loadableError', err);
            deferred.reject(err);
          });

    // No state
    } else {
      deferred.resolve();
    }

    return deferred.promise;
  }
function ( ) { var deferred = $q . defer ( ) ; var current = $state . current ( ) ; // Evaluate if ( current ) { var sources = ( typeof current . load === 'string' ? [ current . load ] : current . load ) || [ ] ; // Get promises $q . all ( sources . map ( function ( src ) { return _createLoadable ( src ) ; } ) . filter ( function ( loadable ) { return ! loadable . isComplete ; } ) . map ( function ( loadable ) { return loadable . promise ; } ) ) . then ( function ( ) { deferred . resolve ( ) ; } , function ( err ) { $rootScope . $broadcast ( '$loadableError' , err ) ; deferred . reject ( err ) ; } ) ; // No state } else { deferred . resolve ( ) ; } return deferred . promise ; }
Load all required items

@return {Promise} A promise fulfilled when the resources are loaded
Load all required items