title: How to use location.path with angularjs rather than $http.get
body: <p>Hi I am working on a angularjs app. This is actually embedded in to joomla.</p>
  
  <p>The URL that caters the json responses keeps changing based on the menu item clicked. For example:</p>
  
  <pre><code>http://localhost/testsite/index.php/good?format=raw
  http://localhost/testsite/index.php/bad?format=raw
  http://localhost/testsite/index.php/ugly?format=raw
  </code></pre>
  
  <p>Is there a way I can use location.path instead of hardcoding a URL.</p>
  
  <p>My controller is below:</p>
  
  <pre><code>var app = angular.module('myApp', ['ui.bootstrap']);
  
  app.filter('startFrom', function() {
      return function(input, start) {
          if(input) {
              start = +start; //parse to int
              return input.slice(start);
          }
          return [];
      }
  });
  app.controller('customersCrtl', function ($scope, $http, $timeout) {
      $http.get('http://localhost/testsite/index.php/good?format=raw').success(function(data){
          $scope.list = data[0]; //before the code was $scope.list = data; The second response with [[that doesn't work is an array with an array inside of it.
          $scope.currentPage = 1; //current page
          $scope.entryLimit = 10; //max no of items to display in a page
          $scope.filteredItems = $scope.list.length; //Initially for no filter  
          $scope.totalItems = $scope.list.length;
      });
      $scope.setPage = function(pageNo) {
          $scope.currentPage = pageNo;
      };
      $scope.filter = function() {
          $timeout(function() { 
              $scope.filteredItems = $scope.filtered.length;
          }, 10);
      };
      $scope.sort_by = function(predicate) {
          $scope.predicate = predicate;
          $scope.reverse = !$scope.reverse;
      };
  });
  </code></pre>
  
  <p>hope you can help.</p>