Angularjs - Reloading a route

Is it possible to reload a certain route if "something" happens?

Example:
Everytime this function is triggered, I need to reload the route with the new ID

$scope.updateDealer = function(zip, country) {
        if(zip) {
            $http.get('files/framework/dealer/near/'+ zip + '/' + country + '').success(function(data) {
                $scope.dealer = {marker: data};
                $location.path('/dealer/:id').search({id: data.id});
                $rootScope.dealerdetails = data;    
                $route.reload();
        });
        } else {
            $scope.dealer = $scope.loadall();
        }

  }  

Routes:

when('/dealer/:id', {templateUrl: 'files/tpl/dealer-details.html?26', controller: 'DealerDetailsCtrl', activetab: 'details'}).  

But somehow, the ID isn't in the DealerDetailsCtrl.

This is the call for the data in DealerDetailsCtrl:

$rootScope.dealerdetails = dealerService.api.get({id: $routeParams.id, token: $scope.token})  

It seems that $routeParams.id is empty and therefor the content isn't loading.

Thank you for your help.

If you visit /dealer/1 (or whatever the id actually is) is $routeParams.id defined for you? All you should have to do is:

    $scope.updateDealer = function(zip, country) {
        if(zip) {
            $http.get('files/framework/dealer/near/'+ zip + '/' + country + '').success(function(data) {
                $scope.dealer = {marker: data};
                $rootScope.dealerdetails = data;
                $location.path('/dealer/' + data.id);
            });
        } else {
            $scope.dealer = $scope.loadall();
        }
  }

Since angular 1.3 you can use $route.updateParams(newParams) to change route params.

Here is a quote from the angular docs...

$route.updateParams(newParams);

Causes $route service to update the current URL, replacing current route parameters with those specified in newParams. Provided property names that match the route's path segment definitions will be interpolated into the location's path, while remaining properties will be treated as query params.

In your case you should use something like this:

$scope.updateDealer = function(zip, country) {
     if(zip) {
         $http.get('files/framework/dealer/near/'+ zip + '/' + country + '').success(function(data) {
             $scope.dealer = {marker: data};    
             $route.updateParams({id: data.id});
         });
     } else {
         $scope.dealer = $scope.loadall();
     }
}

This should do the trick since Angular monitors hash changes routes them appropriately:

window.location.hash = 'dealer/data.id';