0
內我有一個看起來像這樣的元素:聚合物:模板重複陣列陣列
<polymer-element name="page-slides">
<template>
<template repeat="{{row in slideContainer}}">
<ul class="slide-container">
<template repeat="slide in row">
<li class="slide">{{slide.foo}}</li>
</template>
</ul>
</template>
</template>
<script>
Polymer('page-slides', {
ready: function() {
this.slideContainer = [];
for (i = 0; i < 2; i++) {
this.slideContainer.push([]);
for (j = 0; j < 2; j++) {
this.slideContainer[i].push({foo: "foo", bar: "bar"});
}
}
}
});
</script>
</polymer-element>
所以基本上我有一個數組的數組中,我試圖來生成每一個新的UL slideContainer中的數組,以及數組中每一組屬性的新li。
這不,雖然工作,我可以通過這種更換模板訪問信息的陣列的內部,所以我知道數據是存在的:
<template repeat="{{row in slideContainer}}">
<ul class="slide-container">>
<li class="slide">{{row[0].foo}}</li>
</ul>
</template>
我在做什麼錯?