在角NG重复元素之间的差距差距、元素、NG

2023-09-13 04:32:23 作者:百鬼夜行

我显示 DIV 元素作为 inline-block的。有元素之间的一个奇怪的差距,其中一个 NG-重复结束和下一个开始,通过图像所示:

I am having a problem with multiple ng-repeat elements when showing div elements as inline-block. There is a strange gap between elements where one ng-repeat ends and the next one starts, as illustrated by the image:

我创建了一个普拉克来演示此行为:

I have created a plunk to demonstrate this behavior:

这究竟是为什么以及如何删除的差距?

Why is this happening and how to remove the gap?

推荐答案

勾选此普拉克

有一个劈出现在换行内联元素之间移除空间。

There is a hack to remove space between inline elements that appears at line-break.

<div class="red" ng-controller="TestCtrl">
  <div class="blue number" ng-repeat="number in array1 track by $index">{{number}}</div><!--
  --><div class="green number" ng-repeat="number in array2 track by $index">{{number}}</div><!--
  --><div class="teal number" ng-repeat="number in array3 track by $index">{{number}}</div>
</div>

您可以了解更多有关的其他黑客这里。

You could read more about other hacks here.