简体   繁体   English

如何在angularjs中引导异步事件?

[英]How do I bootstrap an async event in angularjs?

I wish to use indexeddb in my angularjs app. 我希望在我的angularjs应用程序中使用indexeddb。 However loading indexeddb and setting op the stores is async; 但是,加载indexeddb并设置存储操作是异步的; and my route's resolve method already starts querying the db for data on page load. 并且我路线的resolve方法已经开始在db中查询页面加载数据。

As the db isn't set up yet, the query fails. 由于尚未设置数据库,因此查询失败。

What is the best way to handle this? 处理此问题的最佳方法是什么?

Is there a way in angularjs to wait for my indexeddb to load before starting the app? 在angularjs中,有没有一种方法可以在启动应用程序之前等待我的indexeddb加载?

You could do manual bootstrap of your modules instead of angular doing it. 您可以手动对模块进行引导,而不必手动执行。 I suppose indexeddb has a way to intimate when it's done loading.. In that callback, you could bootstrap angular. 我想indexeddb在加载完成时有一种提示方法。在该回调中,您可以引导角度。 Refer http://docs.angularjs.org/guide/bootstrap for manual initialization. 请参阅http://docs.angularjs.org/guide/bootstrap进行手动初始化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM