Javascript 在模板中非法使用ng TRANCLUDE指令

Javascript 在模板中非法使用ng TRANCLUDE指令,javascript,angularjs,compiler-construction,angular-directive,angularjs-ng-transclude,Javascript,Angularjs,Compiler Construction,Angular Directive,Angularjs Ng Transclude,当我使用ngTransclude时,页面看起来不错,但出现控制台错误: 在模板中非法使用NGTRANCLUDE指令!未找到需要转换的父指令。元素:{0} 我找到了根本原因:在index.js中,我使用$compile来编译modal指令。似乎$compile不能与ng transclude一起工作。你有什么建议来解决这个问题吗 这是密码 directive.js: template.html: 请检查Plunker链接。它在那里工作。如果你能用你的代码更新链接,也许我们可以帮助你 Link: h

当我使用
ngTransclude
时,页面看起来不错,但出现控制台错误:

在模板中非法使用NGTRANCLUDE指令!未找到需要转换的父指令。元素:{0}

我找到了根本原因:在index.js中,我使用$compile来编译modal指令。似乎$compile不能与ng transclude一起工作。你有什么建议来解决这个问题吗

这是密码

directive.js:

template.html:


请检查Plunker链接。它在那里工作。如果你能用你的代码更新链接,也许我们可以帮助你

Link: https://plnkr.co/edit/ey1fXDwEOVtA64R6Io3q?p=preview

请检查Plunker链接。它在那里工作。如果你能用你的代码更新链接,也许我们可以帮助你

Link: https://plnkr.co/edit/ey1fXDwEOVtA64R6Io3q?p=preview
<modal>
<input type="text" id="test"/>
</modal>
$scope.test = 'test';
$("#test").attr("ng-model", "test");
$compile(modal)($scope);
Link: https://plnkr.co/edit/ey1fXDwEOVtA64R6Io3q?p=preview