0
鑑於TableController的數據結構:角嵌套NG重複表
var obj = {
titles : {
title: 'Title'
, data : ['a title' , 'another title', 'look a title', 'and another']
}
, other-prop : {
title: 'Other Prop'
, data : [3030, 849875, 8888, 48484]
}
}
this.obj = obj;
,如果你的目標是創建一個像表:
table
thead
tr
th "Title"
th "Other Prop"
tbody
tr
td "a title"
td "3030"
tr
td "another title"
td "849875"
tr
td "look a title"
td "8888"
tr
td "and another"
td "48484"
你將如何構建的NG-重複?現在,我有:
div [controller="TableController as table"]
table
thead
tr
th [ng-repeat = "(key, value) in table.obj"]
tbody
tr [ng-repeat = "(key, value) in table.obj"
td [ng-repeat="(key, val) in table.obj track by $index"] "{{value.data}}"
這是給我...
table
thead
tr
th "Title"
th "Other Prop"
tbody
tr
td "['a title' , 'another title', 'look a title', 'and another']"
td "[3030, 849875, 8888, 48484]"
tr
td "['a title' , 'another title', 'look a title', 'and another']"
td "[3030, 849875, 8888, 48484]"
...所以我很接近,但我不能讓...對象在正確的方向列出。
有人嗎?
除非預處理模型以更好地關聯,否則沒有真正的好方法。你將不得不形成你的數據不同。 – 2014-11-06 23:45:19