本文介绍了如何在中间的ng-repeat中插入新行(Angularjs + twitter bootstrap + jade)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想插入新行,如下所示。
I want to insert new line like a following.
div.row
div.span12
div(ng-repeat="(data in datas)")
p data.text
// insert new line when $index is the number divisible by 3.
它是怎么做的?
谢谢。
推荐答案
您可以使用ng-if指令,每次$ index匹配某个条件时都会显示换行符。因此,如果您想在3次迭代后中断:
You can use the ng-if directive, you would show a line break every time your $index matches a certain condition. So if you'd like to break after 3 iterations:
<div ng-repeat="data in datas">
{{ data }}
<br ng-if="($index+1)%3==0">
<div>
这篇关于如何在中间的ng-repeat中插入新行(Angularjs + twitter bootstrap + jade)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!