Last active
August 29, 2015 13:58
-
-
Save jiverson/9977726 to your computer and use it in GitHub Desktop.
Angular page reload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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