javascript - 如何使两列重复列表中的一项?

标签 javascript html angularjs ng-repeat

Angular 重复是否有可能实现这一点?基本上我想知道有没有办法将 2 循环在一起?非常感谢任何帮助!

Controller :

$scope.date=[
    {ID:1,Date:'2016-11-12'},
    {ID:2,Date:'2016-11-15'},
    {ID:3,Date:'2016-12-06'}
]

HTML:

<table border="1" align="center">   
    <tr>            
        <th rowspan="2">ITEMCODE</th>
        <th rowspan="2">DEBTORCODE</th> 
        <th colspan="2" ng-repeat="d in date">{{d.Date}}</th>   
    </tr>       
    <tr>
        <th>Bal</th>
        <th>Order</th>
    </tr>
</table>

我希望 Bal 和 Order 列在每个日期列下并排重复。 And I expect the column Bal and Order will repeat side by side

最佳答案

您可以使用 Angular 1.2 中引入的 ng-repeat-start 和 ng-repeat-end

<th ng-repeat-start="d in date">Bal</th>
<th ng-repeat-end>Order</th>

工作示例 https://jsfiddle.net/9ve3fu0m/

关于javascript - 如何使两列重复列表中的一项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41061663/

相关文章:

javascript - 可以使用方程符号变量吗?

html - 带有 SVG 标志的 CSS 三 Angular 形剪辑路径未在平板电脑/iPad 中显示

html - 为什么 float div会使下一个div占据整个空间?

javascript - 使用 AngularJS 的 Windows Phone 8.1 上的 Phonegap 无法从我的 API 检索 JSONP

javascript - 覆盖链接的按钮

javascript - 如何编写包含两条POST数据的AJAX请求?

javascript - 拉斐尔的拖放和翻译问题

c# - 如何获取 HtmlGenericControl 的属性值?

javascript - AngularJS + Bootstrap - 验证文本框 - 如何仅在用户输入一些数据后显示验证反馈?

javascript - 如何使用 Angular 更新 ng-repeat 中的列表?