我想动态添加 HTML 内容angularJs
,但得到和错误:
"$compile is not defined"
可能是什么原因?
代码
<td ng-repeat="user in users[0].yds" data-title="'Timeline'" sortable="timeline" style="text-align: center" >
<div class="circle_dynamic"></div>
</td>
angular.module('elnApp')
.controller('ProgramtableCtrl', function ($scope, $location, $filter, ngTableParams,
programTableService) {
for(var i=0; i<=$scope.users[0].projects.length; i++){
for(var j=0; j<$scope.users[0].projects[i].results.length; j++){
if($scope.users[0].projects[i].results[j] == 0){
$(".circle_dynamic").html(
$compile(
""
)(scope)
);
console.log('rm')
}else{
$(".circle_dynamic").html(
$compile(
"<i ng-class='circle_class' style='position: absolute;'></i>"
)(scope)
);
console.log('add')
}
}
}
}, true);
}});
如何动态添加html内容?请帮忙