-3

我正在尝试将离子框架添加到我的应用程序中。

为此,我从 ionic 网站下载了“入门模板”。该应用程序的 index.html 文件似乎在浏览器上正确运行并且没有任何问题。但是在为 Android 环境构建之后,该应用程序只显示一个白屏,其中没有任何内容。

以下是 Worklight 项目:https ://dl.dropboxusercontent.com/u/54761340/angulartest.zip

4

2 回答 2

1

我不太明白这是如何在任何地方运行的,因为 HTML 很糟糕:

  • 重复HTMLBODY元素
  • 对 .css 和 .js 文件的引用位置不正确...

请执行下列操作:

  1. 打开angulartest\apps\angulartestapp\common\index.html并将其内容替换为以下内容:

    <!DOCTYPE html>
    <html ng-app="ionicApp">
      <head>
          <meta charset="UTF-8">
          <title>Ionic</title>
          <link rel="shortcut icon" href="images/favicon.png">
          <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
          <link rel="stylesheet" href="css/main.css">
          <link rel="stylesheet" href="css/ionic.min.css">
          <script src="js/ionic.bundle.min.js"></script>
          <script>
              window.$ = window.jQuery = WLJQ;
          </script>
      </head>
    
      <body ng-controller="MyCtrl">
          <ion-header-bar title="myTitle"></ion-header-bar>
          <ion-content has-header="true" padding="true">
              <h2>Content</h2>
          </ion-content>
    
          <script src="js/index.js"></script>
          <script src="js/initOptions.js"></script>
          <script src="js/main.js"></script>
          <script src="js/messages.js"></script>
      </body>
    </html>
    
  2. 右键单击 angulartestapp 文件夹并选择 Run As > Run on Worklight Development Server

  3. 右键单击生成的 Android 项目并选择 Run As > Android application

我已经在 Worklight Console 的 MBS 以及 Android Emulator 中对其进行了测试。似乎在工作,不管它是什么......

于 2014-02-27T20:28:33.210 回答
0
<body id='content'>
</body>

it will conflict with worklight.

you just try to remove the id='content' and try again.

but this may make that deviceReady() function will not be ready forever.

于 2014-03-06T12:13:49.687 回答