Skip to content

Instantly share code, notes, and snippets.

@jiverson
Last active August 29, 2015 13:58
Show Gist options
  • Save jiverson/9977726 to your computer and use it in GitHub Desktop.
Save jiverson/9977726 to your computer and use it in GitHub Desktop.
Angular page reload
/* 1. make sure not to refresh page on search */
$routeProvider.when({
reloadOnSearch = false;
});
/* 2. call to refresh the browser page in the application */
$location.search('refreshed', 'true'); // set the query param
//allow for scope digest cycle
$timeout(function() {
$window.location.reload(true);
});
//---- Page reloads
/* 3. In app.run */
var isRefreshed = $location.search().refreshed; // get query param
$location.search('refreshed', null); // remove query param
$location.replace(); // replace browser history for when going "back"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment