Here's the calling order:

app.config()
app.run()
directive's compile functions (if they are found in the dom)
app.controller()
directive's link functions (again if found)
Here's a simple demo where you can watch each execute (and experiment if you'd like).

From Angular's module docs:

Run blocks - get executed after the injector is created and are used to kickstart the application. Only instances and constants can be injected into run blocks. This is to prevent further system configuration during application run time.

Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests.
One place you see run blocks used is for authentication

angularjs calling order的更多相关文章

  1. TIJ——Chapter Seven:Reusing Classes

    Reusing Classes 有两种常用方式实现类的重用,组件(在新类中创建存在类的对象)和继承. Composition syntax Every non-primitive object has ...

  2. Unit Test with VS.NET

    Unit Test with VS.NET 2014-10-30 定义单元测试框架Visual Studio 2008提供的单元测试框架参考 定义[1] 返回 传统的单元测试:是一段代码(通常一个方法 ...

  3. 转python版本的curl工具pycurl学习

    一 pycurl介绍 pycurl模块为libcurl库提供了一个python接口.libcurl是一个开源免费且方便快捷的基于客户端的url传输库,支持FTP,HTTP,HTTPS,IMAP,IMA ...

  4. Understanding and Analyzing Application Crash Reports

    Introduction When an application crashes, a crash report is created and stored on the device. Crash ...

  5. Thinking in Java,Fourth Edition(Java 编程思想,第四版)学习笔记(八)之Reusing Classes

    The trick is to use the classes without soiling the existing code. 1. composition--simply create obj ...

  6. Integrating AngularJS with RequireJS

    Integrating AngularJS with RequireJS When I first started developing with AngularJS keeping my contr ...

  7. Angularjs 服务注册

    $injector: (When you request a service, the $injector is responsible for finding the correct service ...

  8. 【转】Build Your own Simplified AngularJS in 200 Lines of JavaScript

    原文:http://blog.mgechev.com/2015/03/09/build-learn-your-own-light-lightweight-angularjs/ Build Your o ...

  9. AngularJS -- Module (模块)

    点击查看AngularJS系列目录 转载请注明出处:http://www.cnblogs.com/leosx/ 什么是AngularJS的模块 我们所说的模块,是你的AngularJS应用程序的一个组 ...

随机推荐

  1. unittest单元测试框架总结(转)

    unittest单元测试框架不仅可以适用于单元测试,还可以适用WEB自动化测试用例的开发与执行,该测试框架可组织执行测试用例,并且提供了丰富的断言方法,判断测试用例是否通过,最终生成测试结果.今天笔者 ...

  2. mysql 5.5和5.6版本关于timestamp not null类型字段关于null的处理

    Server version: 5.5.33-31.1-log Percona Server (GPL), Release rel31.1, Revision 566 mysql> CREATE ...

  3. Zabbix分布式监控系统实践 自定义配置

    https://www.zabbix.com/wiki/templates/start 环境介绍OS: Ubuntu 10.10 Server 64-bitServers:zabbix-server: ...

  4. YottaChain主网全面上线预示商业应用的落地区块链云存储不一样的云

    Yottachain存储网12月24日平安夜全面启动,意味着全球首个可商用的区块链存储公链全面落地.对于数据存储来说,小到我们个人的照片文档,大到政企机构数据库资料,都是互联网生活中如影随形的标配. ...

  5. CUDA Error

    第一个问题:CUDA Error: out of memory darknet: ./src/cuda.c:36: check_error: Assertion `0' failed. 已放弃 (核心 ...

  6. 各种IO之间的区别

  7. XCODE真机调试No Devices Registered

    百思不得期解,摸索发现是由于没有选择真机设备的原因, 在Xcode左上角选择真机设备即可.

  8. eclipse 报错:One or more constraints have not been satisfied.

    接受 我有同样的问题.在我的maven项目中添加速度依赖关系后,我在标记选项卡中得到相同的错误.然后我注意到maven项目创建的web.xml文件具有servlet2.3模式.当我将其更改为servl ...

  9. Leetcode_395. Longest Substring with At Least K Repeating Characters_[Devide and Conquer]

    题目链接 对一个字符串,找出一个最长的子串长度,这个子串中所有字符出现的次数至少为k. 1.滑动窗口 一开始把题目看成了,子串中每个字符至多出现k次.如果是这样,那么是一道典型的滑动窗口的题目. 然而 ...

  10. [CSP-S模拟测试]:凤凰院凶真(LCIS)

    题目描述 $\alpha$世界线.凤凰院凶真创立了反抗$SERN$统治的组织“瓦尔基里”.为了脱离$\alpha$线,他需要制作一个世界线变动率测量仪.测量一个世界线相对于另一个世界线的变动率,实质上 ...