将AngularJS指令附加到jQuery.html()中的实时内容

将AngularJS指令附加到jQuery.html()中的实时内容,jquery,html,angularjs,angularjs-directive,live,Jquery,Html,Angularjs,Angularjs Directive,Live,我遇到了一个问题,让我非常沮丧的是,我不得不通过jquerys.html函数来更新视图,所以实际上看起来 $('#目录视图').html(response.html); 这会将项目添加到表中,标记如下 自述文件 文本/纯文本 8分钟前 欧文 您需要在新的html上使用 var element = $compile(response.html)($scope); $('#directory-view').html(element); @Arun他的解决方案有效,我还在$compile页面

我遇到了一个问题,让我非常沮丧的是,我不得不通过jquerys.html函数来更新视图,所以实际上看起来


$('#目录视图').html(response.html);

这会将项目添加到表中,标记如下


自述文件
文本/纯文本
8分钟前
欧文
您需要在新的html上使用

var element = $compile(response.html)($scope);
$('#directory-view').html(element);

@Arun他的解决方案有效,我还在$compile页面上发现了一些东西,这使我得到了一个基于文档的版本

var table=angular.element(response.html);
table=$compile(table)($scope,function(table,$scope){
$('#目录视图').html(表格);
});您需要使用该服务