簡體   English   中英

如何在ng-repeat創建的每個元素之后添加空格

[英]How to add whitespace after each element created by ng-repeat

我正在嘗試從這個問題中進行元素的平均分配。如何平均分配li元素? 我在玉上使用角鋼:

ul
  li(ng-repeat="item in items") {{item.name}}

但是ng-repeat不會在每個元素和text-align: justify之后創建換行符text-align: justify無效。 是否可以在ng-repeat返回的html中的每個li之后插入換行符或空格?

柱塞

使用ng-repeat-startng-repeat-end

ul
  li(ng-repeat-start="step in workflow.data.steps", class="{{step.status|lowercase}}", ng-class="{selected: step.caption == workflow.data.step.caption}")
    //ng-style="{width: (100/(workflow.data.steps.length > 6 ? 6 : workflow.data.steps.length)) + '%'}"
    div
      span.box {{step.caption}}
      span.status(ng-show="workflow.data.steps.loaded") {{step.status}}
      span.status(ng-hide="workflow.data.steps.loaded") ...
  br(ng-repeat-end)

@Fissio解決方案幾乎可以工作,我只需要添加以下CSS:

br {
  display: none;
}

而且有效。 柱塞

只需添加

<li ng-repeat="your code">
<span ng-if="!$first || !$last"><br></span>{{item.name}}
</li>

如果不是第一項和最后一項,則不會添加“ br”。 否則會增加休息時間

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM