title: Using factory in factory in angularjs
body: <p>I have an angular application that reads some data from different APIs and I wrote multiple factories to catch them each factory should use a parameter to retrieve the data which is being provided by a factory. something like this:</p>
  
  <pre><code>var eqDetail = angular.module('eqDetail', []);
  eqDetail.config(['$locationProvider', function($locationProvider) {
    $locationProvider.html5Mode({
      enabled: true,
      requireBase: false
    });
  }]);
  
  
  eqDetail.factory('eqInfoFactory', function($location, $http) {
    return {
      eqInfo: getEqInfo()
  
    }
  
    function getEqInfo() {
      //routines for acquiring data and sanitize data
    });
  return tmp // and object contaning sanitized data           
  }
  });
  eqDetail.factory('lastInspectionDetail', ['eqInfoFactory', function($http,
    eqInfoFactory) {
    return {
      insInfo: getInsInfo()
    }
  
    function getInsInfo() {
      var eq = eqInfoFactory.eqInfo;
      // get second set of data base on 'eq'
  
      return tmp
    }
  }]);
  
  
  eqDetail.controller('eqInfo', function($scope, eqInfoFactory) {
    $scope.eq = {};
    $scope.eq = eqInfoFactory.eqInfo;
    console.log($scope.eq);
  
  });
  eqDetail.controller('inspectionResult', function($scope, lastInspectionDetail) {
    $scope.insResult = lastInspectionDetail.insInfo;
    console.log($scope.insResult)
  })
  </code></pre>
  
  <p>the problem is that <code>eqInfoFactory.eqInfo</code> in the second factory cames out as <code>undefined</code>.</p>
  
  <p>Am I using factories in the right way? and how I can inject them into each other?</p>