AngularJs指令加载事件 [英] AngularJs Directives Loaded Event

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

问题描述

我刚开始使用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


  • 控制器加载

  • 指令1负载

  • 指令2负荷

  • 最后事件会触发(preferably由控制器拾起)

情景2


  • 控制器负载

  • 指令1负载

  • 指令2负荷

  • 指令3负荷

  • 最后事件会触发(preferably由控制器拾起)

我似乎无法找到一个指令加载事件。与搜索,我能找到的最好是这样的 SO帖子, (对此这个答案不工作),但感觉就像一个'一刀切'的做法。

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?

高兴,如果需要张贴code,但它似乎并没有在这种情况下是有益的。

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.

在时加载所有指令通知的情况下,<一个href=\"http://stackoverflow.com/questions/14968690/sending-event-when-angular-js-finished-loading/19686824#19686824\">this一直很好。

In the case of notifying when all directives were loaded, this has been working nicely.

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

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