0

Being bit confused as per the following 2 blogs:

I. Eric W Green - Toptal https://www.toptal.com/angular-js/angular-js-demystifying-directives

Order of execution

Compile -> Controller -> PreLink -> PostLink

II. JsonMore http://jasonmore.net/angular-js-directives-difference-controller-link/

Order of execution

Controller -> Compile -> PreLink -> PostLink

The answer to complex problem difference between controller & link is given here -- use code in controller if required before compile OR write in link if code to be run after compile.

But, blog 1 says both run after compilation. Please, suggest which one is correct?

Deadpool
  • 7,811
  • 9
  • 44
  • 88
  • This might help you: http://stackoverflow.com/questions/15676614/angularjs-link-vs-compile-vs-controller See comments of most up-voted answer – George Kagan Oct 06 '16 at 12:34

1 Answers1

1

The concept is as a matter of fact baffling , but ones you understand the actual flow, it would remain clear throughout.

The actual order of execution is ..Compile -> Controller -> Pre-Link -> Post-Link

For further understanding, just go through this article, it surely helped me.

Hope this helps.

Cheers

Nishi Bangar
  • 720
  • 9
  • 20