0
我构建内部的一个HTML模板for循环,我想在对模板传递变量值,并建立动态模板。在JavaScript构建HTML模板循环
下面是我的for循环,我需要colIndex值提到HTML的标签跨度要传递“极品colIndex这里”
for (var colIndex = 0; colIndex < colCount; colIndex++) {
$scope.gridOptions.columnDefs.push({
name: 'col-' + colIndex,
aggregationType: uiGridConstants.aggregationTypes.sum,
width: 85,
treeAggregationType: uiGridTreeViewConstants.aggregation.SUM,
cellTemplate: '<div class="ui-grid-cell-contents">'+
'<span ng-if="!(row.entity[\'$$\' + col.uid])">{{row.entity[\'col-'+'<<Need colIndex here>>'+'\'] CUSTOM_FILTERS}}</span>'+
'<span ng-if="row.entity[\'$$\' + col.uid]"> {{row.entity["$$" + col.uid].value CUSTOM_FILTERS}}</span>'+
'</div>'
});
}
请建议。
难道你们就不能只是通过它在你填充'name'属性以同样的方式? –
我想更复杂的东西和得到基本字符串连接;)... –