在ui-grid celltemplate中使用ng-if不起作用

时间:2016-11-02 12:37:20

标签: angularjs

我想根据recordType值在我的列中使用不同的链接。这是我的UI-Grid的columndef:

from collections import ChainMap

a = {'x': 1, 'z': 3}
b = {'y' : 2, 'z' : 4}

c = ChainMap(a,b)

print(c)

以上是记录类型之一。这不起作用名字是空白的。无法弄清楚是否存在语法问题。另外如何为cellTemplate添加多个ng-ifs?

1 个答案:

答案 0 :(得分:0)

尝试:

{
field: 'firstName',
displayName: app.localize('First Name'),
enableHiding: false,
cellTemplate: '<div class="ui-grid-cell-contents">{{row.entity.firstName}}</div>'
}

关于if问题。 观点:

<div ui-grid="gridObjectOptions"></div>

控制器:

    gridObjectOptions = {
    /////////////data to cycle (this is your ng-if)
    data: 'camerasEncoders.deviceList',
    onRegisterApi:function(gridApi){
    /////////////here you will be exposed to all the grid data it might be usefull
    },
    /////////////the column Defs we've just wrote, each element in the data will get the cell template you define here 
    columnDefs: [{
    field: 'firstName',
    displayName: app.localize('First Name'),
    enableHiding: false,
    cellTemplate: '<div class="ui-grid-cell-contents">{{row.entity.firstName}}</div>'
    ]}
}

希望它有用,享受:)