config

config(configFn);

Use this method to register work which needs to be performed on module loading.

config阶段是给了ng上下文一个针对constant与provider修改其内部属性的一个阶段

什么代码该写到config里面

run

run(initializationFn);

Use this method to register work which should be performed when the injector is done loading all modules.

ng执行顺序

  1. app.config()
  2. app.run()
  3. directive's compile functions (if they are found in the dom)
  4. app.controller()
  5. directive's link functions (again, if found)

results matching ""

    No results matching ""