title: AngularJS: Inject Restangular and use $location in factory
body: <p>I have the following factory.  I use it to store lists of tabs in various parts of my program.</p>
  
  <pre><code>myApp.factory('RootService', function($location) {
      var tabList = [ ... ];
      var loginTabList = [ ... ];
  
      return {
          setTabList: function(data) {
              tabList = data;
          },
          getTabList: function(data) {
              if ($location.path() !== '/login') { return tabList; }
              else {
                  if (data === 0) { return loginTabList; }
                  else { return tabList; }
              }
          }
      };
  });
  </code></pre>
  
  <p>I wanted to move the initialization of these lists to my Java layer so that I can have them populate from an Oracle database.  I have the back-end sorted out, but when I attempt to inject Restangular into the factory so that I can use it, the factory prevents AngularJS from functioning at all.  With minor changes, I can get AngularJS to work again with one: </p>
  
  <pre><code>myApp.factory('RootService', function($location) { ... });
  </code></pre>
  
  <p>Or the other:</p>
  
  <pre><code>myApp.factory('RootService', ['Restangular', function(Restangular) { ... }]);
  </code></pre>
  
  <p>declarations but not both.  Am I declaring the factory incorrectly?  How can I use both Restangular and $location together?</p>