Directives in a section of the dom are not applied unless the dom is run 
through a $compile and then llinked. What you could do is inject the 
$compile service and call it on the html once the html is loaded. 
Unfortunately, while $.colorbox plugin gives you a callback when the 
content is loaded, it doesn’t really provide you with the dom of the 
content, so you probably have to resort to querying it from the top of the 
dom. For example:

app.directive('colorbox', function($compile, $rootScope){
  return {
    link: function(scope, element, attrs){
      element.click('bind', function(){
        $.colorbox({
          href: attrs.colorbox,
          onComplete: function(){
            $rootScope.$apply(function(){
              var content = $('#cboxLoadedContent');
              $compile(content)($rootScope);      
            })
          }
        });
      });
    }
  };
});

See this plunkr for an example:

<http://plnkr.co/edit/FAbNu8sLg6hZsI5in30K>
http://plnkr.co/edit/FAbNu8sLg6hZsI5in30K

Let me know if you have questions.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to