2
基本上我試圖填充錶行作爲手風琴頭在角度頁:如何在Angular Directive的鏈接函數中插入html?
<div uib-accordion-group ng-repeat="deployment in deployments" is-open="deployment.isOpen">
<uib-accordion-heading>
<status-Table deploy="{{deployment}}"></status-Table>
</uib-accordion-heading>
</div>
我似乎無法找到一種方法,從部署對象進行插值,一旦我把它傳遞給statusTable指令,然後使用這些變量填充HTML:
app.directive('statusTable', function(){
return {
restrict: "E",
scope: {
deploy: '@'
},
link: function(scope, element, attrs){
element.html("<table class='table table-hover'>"+
"<tr>"+
"<td>{{ attrs.deploy.deployment_name }}</td>"+
"<td>{{ attrs.deply.region }}</td>"+
"<td>{{ attrs.deploy.start_date }}</td>"+
"<td>{{ attrs.deploy.deployment_date }}</td>"+
"<td><i class='material-icons
green'>check_circle</i></td>"+
"</tr>"+
"</table>");
}
};
這是Angularjs(1.x)和n ot Angular(2+) – brijmcq
@brijmcq是的,好的先生。 1.6.2 – pandabearit