AngularJS 应用程序应该在读取文件后延迟启动

AngularJS app should delay start after read file

我的 AngularJS 应用程序需要在启动前读取存储的设置,但问题是应用程序在从存储内存读取文件之前启动。 我在 "onDeviceReady" 事件中使用 "cordova.file.dataDirectory"。

您可以为此使用手动引导,添加等待和读取目录的自定义代码,然后启动您的 angular 应用程序。

https://docs.angularjs.org/guide/bootstrap

不使用 ng-app,而是使用: angular.bootstrap(document, ['myApp']);

ng-strict-di 应该能胜任

在你的index.html中:

<body ng-controller="myAppController" ng-strict-di>

并在您成功读取文件后使用 angular.bootstrap

启动应用程序
angular.bootstrap(window.document.body, ['myApp']);