在我的项目中使用的UI网,我得到的JSON对象从DB像下面选中复选框在UI格角JS
[
{
"checkbox1": {
"fieldName": "checkbox1",
"fieldValue": "Y"
},
"checkbox2": {
"fieldName": "checkbox3",
"fieldValue": "Y"
},
"checkbox3": {
"fieldName": "checkbox3",
"fieldValue": "N"
}
}
]
下面对象是columnDef
[
{
"name": "checkbox1",
"field": "checkbox1.fieldValue",
"displayName": "checkbox1",
"cellTemplate": '<input type=\"checkbox\" ng-model=\"{{COL_FIELD}}\" ng-true-value=\'Y\' ng-false-value=\'N\' />'
},
{
"name": "checkbox2",
"field": "checkbox2.fieldValue",
"displayName": "checkbox2",
"cellTemplate": '<input type=\"checkbox\" ng-model=\"{{COL_FIELD}}\" ng-true-value=\'Y\' ng-false-value=\'N\' />'
},
{
"name": "checkbox3",
"field": "checkbox3.fieldValue",
"displayName": "checkbox3",
"cellTemplate": '<input type=\"checkbox\" ng-model=\"{{COL_FIELD}}\" ng-true-value=\'Y\' ng-false-value=\'N\' />'
}
];
渲染后html的,我在控制台收到一个错误:
Error: [$parse:syntax] http://errors.angularjs.org/1.5.0-rc.1/$parse/syntax?p0=%7B&p1=invalid%20key&p2=2&p3=%7B%7Bgrid.getCellValue(row%2Col)%7D%7D&p4=%7Bgrid.getCellValue(row%2C%col)%7D%7D
我该如何解决这个问题?
很难确切地知道它是错误的,但你必须有某种语法错误在你的HTML。错误的线索在查询字符串中:'p0 = {&p1 = invalid key&p2 = 2&p3 = {{grid.getCellValue(row,ol)}}&p4 = {grid.getCellValue(row,col)}}'.. 。你可能拼错了'col',或者你可能错过了一个大开大括号。也有助于看到控制器/ html代码。 –