在多个TR的Angular.js纳克重复 [英] Angular.js ng-repeat across multiple tr's

查看:177
本文介绍了在多个TR的Angular.js纳克重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Angular.js为使用隐藏TRS通过显示tr和在下面的TD滑下div来模拟滑出效果的应用程序。这个过程奋力飞驰使用knockout.js遍历这些行的数组的时候,因为我可以用< - 柯:的foreach - > 各地都TR元素

I am using Angular.js for an application that uses hidden trs to simulate a sliding out effect by showing the tr and sliding down the div in the td below. This process worked fantastically using knockout.js when iterating over an array of these rows, because I could use <!-- ko:foreach --> around both tr elements.

通过角, NG-重复必须应用到HTML元素,这意味着我似乎无法使用标准方法重复这些双行。我对这个第一个反应是要建立一个指令重新present这些双TRS,但下跌短,因为指令模板必须有一个根元素,但我有两个(&LT; TR&GT;&LT ; / TR&GT;&LT; TR&GT;&LT; / TR&GT;

With angular, ng-repeat must be applied to an html element, meaning I cannot seem to repeat these double rows using standard methods. My first response to this was to create a directive to represent these double trs, but that fell short because directive templates must have a single root element, but I have two (<tr></tr><tr></tr>).

如果用NG-重复,谁破获角度经验的人这可以解释如何解决这个问题,我将不胜AP preciative。

If anyone with experience with ng-repeat and angular who has cracked this can explain how to solve this problem, I would be greatly appreciative.

(我也应该注意到,NG-重复连接到TBODY是一种选择,但这样会产生多个tbodys,和我假设是坏的形式,标准的HTML,但纠正我,如果我错了)

(I should also note that attaching ng-repeat to the tbody is an option, but this produces multiple tbodys, and I am assuming that is bad form for standard HTML, although correct me if I'm wrong)

推荐答案

使用 NG-重复 TBODY 出现为有效请参见这个帖子

Using ng-repeat on tbody appears to be valid see this post.

另外通过 HTML验证允许多个 TBODY 中的元素一个快速测试同一个表。

Also a quick test through an html validator allowed multiple tbody elements in the same table.

更新:截至至少角1.2有一个 NG-重复启动 NG-重复性结束允许重复一系列元素。请参见获取更多信息,并感谢文档以@Onite您的评论!

Update: As of at least Angular 1.2 there is an ng-repeat-start and ng-repeat-end to allow repeating a series of elements. See the documentation for more information and thanks to @Onite for the comment!

这篇关于在多个TR的Angular.js纳克重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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