0

Is possible to switch to another angular view in controller? I meant something like this:

function ItemController($http, $routeParams) {
   $http.get('/api/item/' + $routeParams.ItemId).then(function(response) {
       self.related_item = response.data['related_item_id'];
       if (self.related_item != 10) {
           switch_to_another_view('#!/items/' + self.related_item);
       }
   });
}
Florovit
  • 27
  • 1
  • 6

1 Answers1

1

If you are using angular-router or $routeProvider, do it as:

$location.path('items')
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396