title: How to redirect with $location.path in Angular?
body: <p>My main concern is towards the end of this controller. At the $scope.navigate function. Basically I'm looking to see what type an 'offer' is by searching if arg.item_type == "DEAL" or arg.item_type == "EVENT" etc. My problem is to do with the $location.path. I don't know how to redirect with $location.path in Angular. Doesn't work for someone reason.</p>
  
  <p>In the console it says "$location is not defined at Scope.$scope.navigate"</p>
  
  <p>Anyone have any ideas how it works? Thanks</p>
  
  <pre><code>// BUDGET PROFILE
  // A simple controller that fetches a list of data from a service
  .controller('BudgetIndexCtrl', function($scope, $stateParams, $ionicLoading, BudgetService) {
          console.log($stateParams);
          var loading = $ionicLoading.show({
                                           content: 'Loading...',
                                           showBackdrop: true,
                                           maxWidth: 200,
                                           showDelay: 500
                                           });
  
  
          $scope.offers = BudgetService.get($stateParams);
          console.log($scope.offers);
          loading.hide();
  
          // this function is done to look for the TYPE of 'offer'
          $scope.navigate = function(arg) {
  
          if (arg.item_type == "DEAL") {
              $location.path("/tab/deals/" + arg.id);
              $scope.$apply();
          }
  
          if (arg.item_type == "EVENT") {
              $location.path("/tab/events/" + arg.id);
              $scope.$apply();
          }
  
          if (arg.item_type == "ATTRACTION") {
              $location.path("/tab/attractions/" + arg.id);
              $scope.$apply();
          }
  
          //console.log(arg);
          };
  
          })
  </code></pre>