AngularJS 加载完成时发送事件 [英] Sending event when AngularJS finished loading

查看:18
本文介绍了AngularJS 加载完成时发送事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道当所有指令都完成编译/链接时,检测页面加载/引导完成的最佳方法是什么.

Wondered what's the best way to detect the finish of page loading/bootstrapping, when all directives done compiling/linking.

已经有任何活动了吗?我应该重载 bootstrap 函数吗?

Any event already there? Should I overload the bootstrap function?

推荐答案

Angular 没有提供在页面加载完成时发出信号的方法,可能是因为 finished" 取决于您的应用程序.例如,如果您有部分的分层树,一个加载其他.完成"意味着所有这些都已加载.任何框架都很难分析您的代码并理解一切都已完成或仍在等待.为此,您必须提供特定于应用程序的逻辑来检查和确定.

Angular hasn't provided a way to signal when a page finished loading, maybe because "finished" depends on your application. For example, if you have hierarchical tree of partials, one loading the others. "Finish" would mean that all of them have been loaded. Any framework would have a hard time analyzing your code and understanding that everything is done, or still waited upon. For that, you would have to provide application-specific logic to check and determine that.

这篇关于AngularJS 加载完成时发送事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆