I am currently developing an app using AngularJS and the Ionic Framework. In my app, I need to implement a logout button that, upon being clicked by the user, will reload the page to re-bootstap the app and clear all cached data. Following guidance from this particular StackOverflow post, I attempted to use $window.location.reload(true)
. The method worked successfully when testing in the browser with ionic serve
. However, when tested on a mobile device, the screen went blank and did not reload properly.
How can I ensure proper page reload/refresh functionality for mobile devices without encountering a blank screen?
EDIT: Here is the code snippet:
angular.module('login').controller('logoutController', ['$state', '$window', function ($state, $window) {
$state.go('login');
$window.location.reload(true);
}]);
The objective is to reload the location after transitioning to the login
state.