I\'m trying to write a directive that dynamically adds directives of another type to the DOM and compile them. It seems to work when using a string template, but fails when usi
Adding scope.$apply() worked for me. Tested with jQuery 1.9.0 and Angular 1.0.3.
iElement.bind('click', function() {
$('body').append($compile(t)(scope));
scope.$apply(); // cause a $digest cycle to run, since we're "outside" Angular
});
This fiddle uses an inlined template, but I also tested with a local webserver that had to do a separate HTTP GET to get the partial.