title: Accessing factory defined in another module in angularjs
body: <p>Can we call the factory functions defined in one module from another module? If so, how?</p>
  
  <p>Let's say my first module is defined in <code>moduleOne.js</code> file as:</p>
  
  <pre><code>var myModule = angular.module('MyServiceModuleOne', []);
  myModule.factory('notify', function () {
      return {
          sampleFun: function () {
              // some code to call sampleFunTwo()
          },
      };
  });
  </code></pre>
  
  <p>And my second module in <code>moduleTwo.js</code> as:</p>
  
  <pre><code>var myModuleTwo = angular.module('MyServiceModuleTwo', []);
  myModuleTwo.factory('notifytwo', function () {
      return {
          sampleFunTwo: function () {
              // code
          },
      };
  });
  </code></pre>
  
  <p>How to call <code>sampleFunTwo()</code> from <code>sampleFun()</code>?</p>
  
  <p>Thanks.</p>