I am trying to refresh a page after showing a successfull message. I tied with many snippets but either it gets refreshed without showing message or vice-versa.
So I thought of Calling the Refresh function after an interval or Trigger again the button click event after some time to get the page refreshed.
Here is the code, How to achieve the above scenario?
JS CODE
$scope.Save = function (data) {
debugger;
$http.post($rootScope.WebApiURL + '/updatemanifeststatus');
var value= $http.get($rootScope.WebApiURL + '/getmanifeststatus' );
$scope.manifeststatus = data;
$scope.showstatus = true;
$scope.alert = { type: 'success', msg: 'Published Successfully.' };
$(".statusDivPublish").show();
$scope.Refresh1();
}
$scope.Refresh1 = function () {
//refresh
$state.go($state.current, {}, { reload: true });
}
});
HTML Button Call
<div class="col-sm-offset-1">
<button id="PublishButton" class="btn btn-default shiny " ng-disabled="manifeststatus.enablePublishButton" ng-click="Save(manifeststatus)">Publish</button>
</div>
What I want to do Here is Call the Refresh1() function after a time gap in such a way, the page gets refreshed after showing the message.
$state.reloadinstead to fire$scope.Refresh1function. If you are using ui-router.toastlibrary if you only need to show some alert for a period. github.com/jirikavi/AngularJS-Toaster