Angular 5 与科尔多瓦 (Phonegap)
Angular 5 with Cordova (Phonegap)
设置:使用 ng new mobile
创建新的 angular 项目,并使用 ng build
创建该项目的构建。然后通过 phonegap create mobile
创建空的 cordova 项目并将 dist 文件夹的内容从 angular 移动到 phonegap 项目的 www 文件夹,并添加到 index.html <script src="cordova.js"></script>
问题:当我打开该应用程序的浏览器版本时,一切正常,但当我在 phonegap 应用程序中打开该应用程序进行测试时,没有任何显示。文件 index.html
正在正常打开,但 <app-root></app-root>
没有填满页面。
登录启动应用程序:
[phonegap] starting app server...
[phonegap] listening on 192.168.0.102:8080
[phonegap]
[phonegap] ctrl-c to stop the server
[phonegap]
在浏览器中打开的页面上登录:
[phonegap] 200 /
[phonegap] 200 /cordova.js
[phonegap] 304 /socket.io/socket.io.js
[phonegap] 200 /styles.bundle.js
[phonegap] 200 /inline.bundle.js
[phonegap] 200 /main.bundle.js
[phonegap] 200 /polyfills.bundle.js
[phonegap] 200 /vendor.bundle.js
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b8xS3
[phonegap] 200 /cordova_plugins.js
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b8xSy&sid=20QHVka_YOvFssMwAAAA
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b8xTY&sid=20QHVka_YOvFssMwAAAA
在 phonegap 应用程序打开的页面上登录:
[phonegap] [console.warn] Content Security Policy has been modified to be: https://ssl.gstatic.com > 'unsafe-eval' * ws:;style-src 'self' 'unsafe-inline' data: blob:;media-src *;img-src 'self' data: content: *;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;">
[phonegap] 200 /api/appzip
[phonegap] 200 /socket.io/socket.io.js
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b98u4
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b98uZ&sid=ObEnma7oyhhUimWDAAAB
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b98un&sid=ObEnma7oyhhUimWDAAAB
将 index.html 中的 base href=“/” 标记更新为 base href=“./”
设置:使用 ng new mobile
创建新的 angular 项目,并使用 ng build
创建该项目的构建。然后通过 phonegap create mobile
创建空的 cordova 项目并将 dist 文件夹的内容从 angular 移动到 phonegap 项目的 www 文件夹,并添加到 index.html <script src="cordova.js"></script>
问题:当我打开该应用程序的浏览器版本时,一切正常,但当我在 phonegap 应用程序中打开该应用程序进行测试时,没有任何显示。文件 index.html
正在正常打开,但 <app-root></app-root>
没有填满页面。
登录启动应用程序:
[phonegap] starting app server...
[phonegap] listening on 192.168.0.102:8080
[phonegap]
[phonegap] ctrl-c to stop the server
[phonegap]
在浏览器中打开的页面上登录:
[phonegap] 200 /
[phonegap] 200 /cordova.js
[phonegap] 304 /socket.io/socket.io.js
[phonegap] 200 /styles.bundle.js
[phonegap] 200 /inline.bundle.js
[phonegap] 200 /main.bundle.js
[phonegap] 200 /polyfills.bundle.js
[phonegap] 200 /vendor.bundle.js
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b8xS3
[phonegap] 200 /cordova_plugins.js
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b8xSy&sid=20QHVka_YOvFssMwAAAA
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b8xTY&sid=20QHVka_YOvFssMwAAAA
在 phonegap 应用程序打开的页面上登录:
[phonegap] [console.warn] Content Security Policy has been modified to be: https://ssl.gstatic.com > 'unsafe-eval' * ws:;style-src 'self' 'unsafe-inline' data: blob:;media-src *;img-src 'self' data: content: *;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;">
[phonegap] 200 /api/appzip
[phonegap] 200 /socket.io/socket.io.js
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b98u4
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b98uZ&sid=ObEnma7oyhhUimWDAAAB
[phonegap] 200 /socket.io/?EIO=3&transport=polling&t=M8b98un&sid=ObEnma7oyhhUimWDAAAB
将 index.html 中的 base href=“/” 标记更新为 base href=“./”