【发布时间】:2019-10-21 00:12:53
【问题描述】:
我有一个可能看起来像这样的指令:
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);
}
}
});
当我编译以隔离范围时,它不起作用。没有显示内容。如果我编译到父范围,它似乎会起作用。我可以使用隔离范围吗?
谢谢
【问题讨论】:
-
你的链接是404。
-
jsfiddle.net/sh0ber/6m54x9hc 你的代码对我来说没问题
标签: angularjs angularjs-directive angularjs-compile