I would like to reboot my Ionic app programmatically.
I found solutions to only reload the current view like location.reload(), but I would like the app the re-run the app.js, both for iOS and Android.
I wouldn't recomend going with that approach, in single page apps always try to have a system to reset the data, cache, history, etc. and then go to the initial state, instead of forcing to refresh de webUI. Ionic has a lot of features to help you accomplish that.
Try this solution
var initialHref = window.location.href;
navigator.splashscreen.show();
// Reload original app url (ie your index.html file)
window.location = initialHref;
navigator.splashscreen.hide();
or you can hide your splash screen app.js inside
.run(function(){
$ionicPlatform.ready(function () {
if (cordova.platformId === 'ios' && window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
navigator.splashscreen.hide();
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With