I have a directive that might look like this:
a.directive('autoResize', function($compile) {
return {
scope: {},
link: function(scope, elem) {
// HTML here is just an example
var template = angular.element('<div some-angular-stuff></div>');
$(elem).append(template);
template = $compile(template)(scope);
}
}
});
When I compile to isolate scope it's not working. No content is shown. Seems like it would work if I compile to the parent scope. Any chance I could use the isolate scope?
Thanks
$compilereturns a function that when you call it returns an element so you need to append it to the DOM by yourself:https://docs.angularjs.org/guide/compiler#how-directives-are-compiled