AngularJS promise in app.run() [duplicate]

泄露秘密 提交于 2019-11-30 20:35:43

Angular does not support asynchronous actions in .config and .run functions. If you want to delay your application, there are 2 ways:

  • The first one is to delay your whole application by using angular.bootstrap() to manually start it. But anything you do is outside angular, so you don't have access to anything but vanilla JavaScript.
  • The second one is to use the resolve property of your routes. If you use a router like angular route segment or ui router, you can define a top route / state with a resolve which would be resolved when your application loads (and if you force a full reload of your route).
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!