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
Let me know if you have questions.
--You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/9LOB2A1ZUoM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.