I'm using AngularJS and the Ionic Framework to build an app. My app needs to have a logout button. When the user presses the logout button, I would like to reload the page so that the app is re-bootstrapped and all cached data is wiped clean. Based on this StackOverflow Question I should be able to just do $window.location.reload(true)
. That works fine if I'm just running the app in the browser via ionic serve
. However, when I run it on an actual device, the screen just goes blank and never comes back. How can I reload/refresh the page on the mobile device without getting a blank screen?
EDIT: Here's my actual code:
angular.module('login').controller('logoutController', ['$state', '$window', function ($state, $window) {
$state.go('login');
$window.location.reload(true);
}]);
I'm trying to reload the location after transitioning to the login
state.