在角NG重复元素之间的差距 [英] Gap between ng-repeat elements in Angular

查看:119
本文介绍了在角NG重复元素之间的差距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我显示 DIV 元素作为 NG-重复元素的问题> 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.

这篇关于在角NG重复元素之间的差距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆