Angular.js ng-repeat 跨多个元素 [英] Angular.js ng-repeat across multiple elements

查看:23
本文介绍了Angular.js ng-repeat 跨多个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里已经部分解决了这个问题:Angular.jsng-repeat 跨多个 tr

This question has been partly addressed here: Angular.js ng-repeat across multiple tr's

然而,这实际上只是一种解决方法,它实际上并没有解决核心问题,即:如何在没有包装器的情况下跨多个元素使用 ng-repeat?

However that is just a work-around really, it doesn't actually address the core issue, which is: how can one use ng-repeat across multiple elements without a wrapper?

例如,jquery.accordion 要求您重复 h3 和 div 元素,如何使用 ng-repeat 做到这一点?

For example, jquery.accordion requires you to repeat an h3 and div element, how could one do this with ng-repeat?

推荐答案

我们现在对此有了适当的支持,请参阅:

We now have a proper support for this, please see:

通过此更改,您现在可以执行以下操作:

with this change you can now do:

<table>
  <tr ng-repeat-start="item in list">
      <td>I get repeated</td>
  </tr>
  <tr ng-repeat-end>
      <td>I also get repeated</td>
  </tr>
</table>

这篇关于Angular.js ng-repeat 跨多个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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