我想以编程方式重新启动我的Ionic应用程序。
我发现只能重新加载当前视图的解决方案,如
我发现只能重新加载当前视图的解决方案,如
location.reload()
,但我希望应用程序重新运行app.js,无论是iOS还是Android。location.reload()
,但我希望应用程序重新运行app.js,无论是iOS还是Android。我不建议采用那种方式,在单页应用中,总是要尝试拥有一个系统来重置数据、缓存、历史记录等,然后返回到初始状态,而不是强制刷新Web用户界面。Ionic有很多功能可以帮助您实现这一点。
app.js
的例子吗? - Nooruddin Lakhanivar initialHref = window.location.href;
navigator.splashscreen.show();
// Reload original app url (ie your index.html file)
window.location = initialHref;
navigator.splashscreen.hide();
标签里面
。.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();
})