This question is pretty informative about pre-link and post-link using the compile attribute in a directive definition. However, it doesn't say anything about what it means to just straight up use the link attribute. I'm talking about the difference between these two things:
A:
myApp.directive('log', function() {
return {
link: function(...){...},
// other stuff here
};
});
B.
myApp.directive('log', function() {
return {
compile: function(...){
return {
pre: function preLink( scope, element, attributes ) {
// stuff
},
post: function postLink( scope, element, attributes ) {
// stuff
}
}
},
// other stuff here
};
});
What is a link
function? Is it supposed to combine pre and post? I do not understand how to use these two patterns differently.