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

时间:2016-12-05 11:22:16

标签: javascript html angularjs

我试图从这个问题中平等分配元素How to distribute li elements equally?我使用角度与玉石:

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

但是ng-repeat不会在每个元素之后创建换行符并且text-align: justify不起作用。是否可以在ng-repeat返回的html中的每个li之后注入换行符或空格?

Plunker

1 个答案:

答案 0 :(得分:1)

使用ng-repeat-start and ng-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)