title: How to solve 'TypeError: $location.absUrl is not a function' error in AngularJS
body: <p>I am working on a legacy AngularJS application and currently just upgraded to AngularJS 1.7.6. The application uses ui-router and in <code>angular.module().config</code> we have some code that uses <code>$location.absUrl.</code> </p>
  
  <p>I know <code>$location</code> can't be injected in normal way to module.config so we are using the <code>$injector</code> as suggested on ui-router website. <a href="https://github.com/angular-ui/ui-router/wiki/URL-Routing" rel="nofollow noreferrer">https://github.com/angular-ui/ui-router/wiki/URL-Routing</a></p>
  
  <p>However, <code>$location.absUrl</code> always return the above error on the title. according to AngularJs documentation, <code>$location.absUrl</code> is still supported in Angular 1.7.6. I hope someone could point me out the right direction.</p>
  
  <pre><code>$urlRouterProvider.otherwise(function ($injector, $location){
          var url = $location.absUrl();            
  
          if (url.indexOf('/admin') !== -1) {
              $location.path("/admin");
          }
          else {
              $location.path("home");
          }
      });
  </code></pre>