如何等待网站完全加载后再在屏幕上显示(离子应用程序开发)



我正在开发一个离子移动应用程序。我想加载一个网站,并在完全加载后将其显示在屏幕上。在等待网站加载时,我希望有一张背景图片和一个微调器,向用户指示他/她必须等待。下面是我用来加载网站的代码(在app.js文件中(。然而,我不确定命令应该放在哪里。

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    window.open('https://www.google.com', '_self', 'location=no');
    if(window.cordova && window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
      cordova.plugins.Keyboard.disableScroll(true);
      }
    if(window.StatusBar) {
      StatusBar.styleDefault();
     }
  });
})    

在index.html文件中:

<ion-pane>
  <ion-header-bar class="bar-stable">
    <h1 class="title" aligh=center >Starter</h1>
  </ion-header-bar>
  <ion-content> 
  <ion-spinner icon="spiral"></ion-spinner>
  </ion-content>
</ion-pane>

我需要一个控制器来完成任务吗(知道网站何时准备好并显示它(?

可能是您可以在中写入

$(window).load(function(){ ... });

最新更新