You can use a pre-link function instead of the default post-link function like this:
app.directive("log", function() {
return {
link: {
pre: function(scope, element, attrs) {
console.log("PRE LINKED " + attrs.name);
},
post: function(scope, element, attrs) {
console.log("POST LINKED " + attrs.name);
}
}
};
});
The pre-link function is backward order from post-link function.
--