我正在尝试在Angular Framework中创建带有UI-Grid不同格式的列。
columnDefs: [{
name: 'Column', width: 300, visible: true, cellTemplate: '<a href="modelremote:{{ grid.getCellValue(row, col) }}">{{ grid.getCellValue(row, col) }}</a>'
}]
但是,当代码运行时,我会收到以下错误
jinja2.exceptions.UndefinedError: 'grid' is undefined
在事后看来,这里的解决方案很明显。错误消息指向jinja2,这是我用来使用页面的模板引擎。
Angular和Jinja2使用{{
和}}
,这是具有讽刺意味
简单地逃脱了卷曲括号可以解决问题。
columnDefs: [{
name: 'Column', width: 300, visible: true, cellTemplate: '<a href="modelremote:{{ grid.getCellValue(row, col) }}">{{ grid.getCellValue(row, col) }}</a>'
}]