0
我是角js的新手。我已經在Conditional cell template in ui-grid angularjs之前閱讀過這個問題,它絕對適用於我,但我只是想知道如何顯示html而不是文本,因爲當我試圖將其更改爲html時,它始終將html顯示爲文本在angularjs網格單元格模板中綁定html
因爲我的英語不好JS的
感謝和抱歉文件
var columnDefs = [
{
field: 'action',
displayName: label.action,
width : 175,
enableCellEdit: false,
cellTemplate: '<div>{{grid.appScope.states.showMe(row.entity.j_code, row.entity.branch_cd)}}</div>',
}];
scope.gridOptions.columnDefs = comlumnDefs;
$scope.states = {
showMe: function(j_code, branch_cd) {
template = "<button class='btn-small btn-green btn-add'>Add</button>";
if (j_code != "" && branch_cd != "") {
template += "<button class='btn-small btn-green'>Copy</button>";
}
return template;
}
};
HTML文件
<div id="grid1" class="gridStyle" ui-grid="gridOptions" external-scopes="states" ui-grid-pinning ui-grid-resize-columns ui-grid-pagination ui-grid-edit ui-grid-row-edit ui-grid-cellnav ui-grid-selection ui-grid-exporter></div>
如果你希望人們提供建議,你應該展示你的代碼。 – KreepN
我已編輯我的帖子,這裏的問題是它始終顯示爲文本,我想要的只是顯示按鈕。請幫忙@KreepN – user3783161