I\'m giving a first try at AngularJS custom directives.
I\'m having trouble using (or understanding ...) the isolated scope in the link function of the directive.
well, none of the answers above actually mentioned one key aspect, even with '=', it doesn't seem to me you can access the scope inside link function directly like the following,
scope: {
    data: '=',
},
link: function(scope, elem, attrs) {
    console.debug(scope.data); // undefined
but you can access the scope in the internal function,
link: function(scope, elem, attrs) {
    scope.saveComment = function() {
        console.debug(scope.data);
so it seems to me there might be a time lag in when scope.data can be available.