title: Display Message and refresh page on a single click In Angular JS
body: <p>I want to Refresh the page after displaying a message or alert saying "Successful" or vice-versa. How can I implement it?</p>
  
  <p>I tried refresing code but it do not display message after that.</p>
  
  <pre><code>HTML CODE:
  
  &lt;div class="row" ng-controller="PublishManifestCtrl"&gt;
  &lt;div class="col-xs-12 col-md-12"&gt;
      &lt;div class="widget"&gt;
          &lt;div class="widget-header bordered-bottom bordered-themeprimary"&gt;
              &lt;i class="widget-icon fa fa-tasks themeprimary"&gt;&lt;/i&gt;
              &lt;span class="widget-caption themeprimary"&gt;Manifest Status&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="widget-body"&gt;
              &lt;form class="form-bordered" role="form"&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label style="padding-left: 8px;"&gt;Manifest was last published to agents on &lt;b&gt;{{manifeststatus.manifestLastPublishedDate}}&lt;/b&gt;.&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label style="padding-left: 8px;"&gt;Manifest was last updated by &lt;b&gt; {{manifeststatus.lastUpdatedByUser}} &lt;/b&gt; on &lt;b&gt;{{manifeststatus.manifestLastedUpdatedDate}}&lt;/b&gt;.&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;div class="col-sm-offset-1"&gt;
                          &lt;button id="PublishButton" class="btn btn-default shiny " ng-disabled="manifeststatus.enablePublishButton" ng-click="Save(manifeststatus)"&gt;Publish&lt;/button&gt;
                      &lt;/div&gt;
                      &lt;br/&gt;
                      &lt;div id="statusDivPublish" ng-show="showstatus"&gt;
                          &lt;alert type="{{alert.type}}"&gt;{{alert.msg}}&lt;/alert&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>
      JS Code:</p>
  
  <pre><code>app.controller('PublishManifestCtrl', function ($scope, $rootScope, $http) {
  
  $scope.showstatus = false;
  
  $http({
      url: $rootScope.WebApiURL + '/getmanifeststatus',
      method:get(),
      params: { 'foobar': new Date().getTime() }
  }).
  success(function (data, status, headers, config) {
      var options = { year: "numeric", month: "long", day: "numeric", hour: "numeric", minute: "numeric" };
  
      data.manifestLastedUpdatedDate = (new Date(data.lastUpdatedDateTime)).toLocaleDateString('en-US', options);
      data.manifestLastPublishedDate = (new Date(data.lastPublishDateTime)).toLocaleDateString('en-US', options);
      var date1 = new Date(data.lastUpdatedDateTime);
      var date2 = new Date(data.lastPublishDateTime);
      data.enablePublishButton = date2.getTime() &gt; date1.getTime();
  
      $scope.manifeststatus = data;
  }).
  error(function (data, status, headers, config) {
      alert('error' + status);
      // log error
  }); 
  $scope.Save = function (data) {
      debugger;
      $http.post($rootScope.WebApiURL + '/updatemanifeststatus');
      //refresh
       $state.transitionTo($state.current, $stateParams, {
       reload: true,
      inherit: false,
     notify: true
      });
      $scope.showstatus = true;
      $scope.alert = { type: 'success', msg: 'Published Successfully.' };
      $(".statusDivPublish").show();
  )});
  </code></pre>
  
  <p>Implementation</p>
  
  <pre><code>$scope.Save = function (data) {
        // debugger;
          $http.post($rootScope.WebApiURL + '/updatemanifeststatus');
         //made change
          $scope.manifeststatus = data;
          $scope.showstatus = true;
          $scope.alert = { type: 'success', msg: 'Published Successfully.' };
          $(".statusDivPublish").show();
  
  
          //refresh
          $state.transitionTo($state.current, $stateParams, {
              reload: true,
              inherit: false,
              notify: true
          });
  
      }   
    });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qB2xe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qB2xe.png" alt="enter image description here"></a></p>
  
  <p>Originally It should be in this way:
  <a href="https://i.stack.imgur.com/IFhqY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IFhqY.png" alt="enter image description here"></a></p>