リンク関数を呼び出すelement.html()
と、トランスクルージョンされた要素がコンパイルされなくなります。それは本当にそれをすべて言い、plunker が実演しますが、コードは次のとおりです。
指令:
app.directive('myDirective', function() {
var compile, config, link;
link = function(scope, element, attr) {
element.html();
};
compile = function() {
return link;
};
config = {
transclude: true,
template: '<div ng-transclude></div>',
compile: compile,
scope: {}
};
return config;
});
HTML:
以下では、出力はコンパイルされていないものです{{foo}}
<div my-directive>
{{foo}}
</div>
これはバグですか、それとも根本的な何かが欠けていますか?
注: 関数内で が呼び出された場合、これは問題ではありません。element.html()
compile
角度 v1.0.6、jQuery v1.9.1