0

我用收集重复下面MD-格砖,离子收集重复的问题

<md-grid-tile collection-repeat="record in records" md-rowspan="1" 
md-colspan="1" md-colspan-sm="1" > 
<!--- Rest of code ---> 
</md-grid-tile> 

但是当我运行它,它会在控制台中显示错误这样的。

Error: collection-repeat tried to compute the height of repeated elements "record in records", but was unable to. Please provide the "item-height" attribute

有什么办法解决这个问题?

+0

以及错误似乎很清楚和具体。你有没有尝试设置'项目高度'? – kachhalimbu

+0

您应该阅读'collection-repeat'的[docs](http://ionicframework.com/docs/api/directive/collectionRepeat/)。 – QueryLars

+0

是的,我没有设置,因为我需要,它从集合获取高度和宽度本身 - 重复 – Walker

回答

2

collection-repeat适用于item-heightitem-width。当这些不提供时,它假定集合中的所有元素将具有与第一个元素相同的高度。当离子无法计算时,它会在您的收集重复元素中查找项目高度属性。

+1

有没有什么办法来动态计算高度和宽度 – Walker

+0

还没有。也许看看文档。他们在近期更新的离子版中彻底收集了重复收集。 (1.0.0) –