Solved it in the following manner:
app.directive('fancybox', function() {
return {
restrict: 'A',
link: function(scope, element) {
if (scope.$last) setTimeout(function() {
$('.fancybox').fancybox({
theme : 'dark'
});
}, 1);
}
};
});
Adding the scope.$last condition makes it so that the fancybox is applied only when all the images have been loaded (as opposed to applying it to each image as it is being added to the DOM). Now the data-group/rel function works.