【发布时间】:2016-12-11 15:08:27
【问题描述】:
所以这可能很难解释,但基本上我无法弄清楚如何将对象的字段值评估为指令将用于从范围分配数据的字符串......我有以下模板指令:
<hot-column ng-repeat="column in columns"
data="{{column.fieldName}}"
title="column.title"
source="column.lookupField"> // <-- I need this to evaluate to the **"list_currency"** (which I will set on the scope) I cant figure out how this needs to look
</hot-column>
我的列对象是这样的:
[
{
"fieldName": "ccy1",
"title": "Ccy1",
"lookupField": "list_currency"
},
{
"fieldName": "ccy2",
"title": "Ccy2"
}
]
在控制器中我有这个范围变量:
$scope.list_currency = ["USD", "EUR"];
我尝试了一些组合,但都不起作用:
source="{{column.lookupField}}" // ==> angular.js:13424 Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 2 of the expression [{{column.lookupField}}] starting at [{{column.lookupField}}].
source="'{{column.lookupField}}'"
source="column.lookupField"
source="'column.lookupField'"
【问题讨论】:
-
试试
{{[column.lookupField]}} -
angular.js:13424 错误:[$parse:syntax] 语法错误:从 [{{[column.lookupField]}}] 开始的表达式 [{{[column.lookupField]}}] 的第 2 列中的标记“{”无效键{[column.lookupField]}}]。
标签: angularjs angularjs-directive handsontable