0
我有2個JSON如下:嵌套角度表達
users= [
{
"id": 0,
"isActive": true,
"age": 30,
"name": "Hester Nunez",
"dob": "10/12/2015",
"email": "[email protected]",
"phone": "+1 (975) 580-3067",
"address": "918 Greenpoint Avenue, Elbert, Idaho, 7423"
},
{
"id": 1,
"isActive": false,
"age": 23,
"name": "Hopkins Cantu",
"gender": "male",
"dob": "16/02/2011",
"email": "[email protected]",
"phone": "+1 (966) 514-3562",
"address": "332 Aurelia Court, Wright, New Mexico, 1481"
}]
columns = [
{
"id": "column1",
"key": "name",
"title": "Name"
},
{
"id": "column2",
"key": "age",
"title": "Age"
},
{
"id": "column3",
"key": "gender",
"title": "Gender"
},
{
"id": "column4",
"key": "email",
"title": "Email"
},
{
"id": "column5",
"key": "address",
"title": "Address"
}
]
要創建一個用戶表我想顯示用戶的基於列的核心價值。事情是這樣的:
<tr data-ng-repeat="user in users">
<td data-ng-repeat="column in columns">{{user.{{column.key}}}}</td>
</tr>
正如預期的那樣,我發現了以下分析錯誤:
Error: [$parse:syntax] Syntax Error: Token '{' is not a valid identifier at column 6 of the expression [user.{{column.key] starting at [{{column.key].
如何評價這種嵌套式有什麼建議?
使用{{用戶[column.key]}} –