AngularJs 指令加载事件 [英] AngularJs Directives Loaded Event
问题描述
我刚刚开始使用 AngularJs 指令,使用资源这里,这里 和 这里.
I have just started using AngularJs directives, using the resources here, here and here.
我有一种情况,我需要在加载所有指令后做一些事情.
I have a situation where i need to do something after all directives have been loaded.
即
场景一
- 控制器负载
- 指令 1 加载
- 指令 2 加载
- 最终事件触发(最好由控制器接收)
场景 2
- 控制器负载
- 指令 1 加载
- 指令 2 加载
- 指令 3 加载
- 最终事件触发(最好由控制器接收)
我似乎找不到指令加载"事件.通过搜索,我能找到的最好的是这个 SO post,(对于这个答案确实有效),但感觉像是一种广泛的刷子"方法.
I can't seem to find a 'directives loaded' event. With a search, the best I could find was this SO post, (for which this answer does work), but it feels like a 'broad brush' approach.
请问正确的做法是什么?
What is the correct way of doing this please?
如果需要,很乐意发布代码,但在这种情况下似乎没有好处.
Happy to post code if needed, but it doesn't seem beneficial in this instance.
推荐答案
为了搜索者的利益...
For the benefit of searchers...
@jack.the.ripper 的评论是正确的.SignalR 的东西确实需要转移到服务上.
@jack.the.ripper 's comment was correct. The SignalR stuff did need moving out to a service.
在所有指令加载时通知的情况下,这一直运行良好.
In the case of notifying when all directives were loaded, this has been working nicely.
这篇关于AngularJs 指令加载事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!