【发布时间】:2017-02-15 04:46:48
【问题描述】:
根据以下 2 个博客有点困惑:
I. Eric W Green - Toptal https://www.toptal.com/angular-js/angular-js-demystifying-directives
执行顺序
Compile -> Controller -> PreLink -> PostLink
II. JsonMore http://jasonmore.net/angular-js-directives-difference-controller-link/
执行顺序
Controller -> Compile -> PreLink -> PostLink
controller & link 之间的复杂问题区别的答案在这里给出——如果需要在编译之前使用控制器中的代码OR 如果代码要在编译后运行,请在链接中写入。
但是,博客 1 说两者都在编译后运行。请问哪一个是正确的?
【问题讨论】:
-
这可能会对您有所帮助:stackoverflow.com/questions/15676614/… 查看投票率最高的答案
标签: javascript angularjs function model-view-controller angularjs-directive