SunnyShahon Stack Overflow • Recommends
On “What is the difference between compile and link function in angularjs”
This is from Misko 's talk on directives. link to this video
Think of the compiler function as
the thing that works on a template and the thing that is allowed to
change the template itself by, for example, adding a class to it or
anything like that. But it's the linking function that actually does
the work of binding the two together because the linking function has
access to the scope and it's the linking function that executes once
for each instantiation of the particular template. So the only kind of
things you can placed inside of the compile functions are things that
are common across all of the instances.