3

I have tried using $state but nothing happens. I am new to angular

       $http({
             method:'PUT',
             url: '/api/resources,
             data:dataObject,
             headers: {'Content-Type': 'application/json'}
        }).success(function(data, status, headers, config){
            AppAlert.add('success', 'The appointment was updated successfully.', 5000);
            $state.go('.', {}, {reload: true});
anna
  • 93
  • 3
  • 13

2 Answers2

3

you can use $route.reload() to reload the current route or $window.location.reload() to perform a full refresh

you just need to inject those services.

AngularJs: Reload page

Community
  • 1
  • 1
bto.rdz
  • 6,636
  • 4
  • 35
  • 52
  • Thanks! It worked and also what if I want to stay on the same page on refresh. In my case I am being redirected to the default page on refresh – anna Sep 02 '14 at 17:11
1

It looks like you are using ui-router so you want to use

$state.transitionTo($state.current, $stateParams, {
    reload: true,
    inherit: false,
    notify: true
});
Malkus
  • 3,686
  • 2
  • 24
  • 39