有角度的ng用多个td重复tr
Angular ng-repeat repeat tr with multiple td
我正在开发我的电子商务应用程序,并试图在我的应用程序中实现angular js。
我当前没有angular的html代码是这样的。每个tr有4个产品。
<table style="border-collapse:collapse;width: 769px">
<tbody>
<tr>
<td style="border:1px Dashed #bfbfbf;width: 192px;">/*Product Details goes here*/</td>
<td style="border:1px Dashed #bfbfbf;width: 192px;">/*Product Details goes here*/</td>
<td style="border:1px Dashed #bfbfbf;width: 192px;">/*Product Details goes here*/</td>
<td style="border:1px Dashed #bfbfbf;width: 192px;">/*Product Details goes here*/</td>
</tr>
<tr>
<td style="border:1px Dashed #bfbfbf;width: 192px;">/*Product Details goes here*/</td>
<td style="border:1px Dashed #bfbfbf;width: 192px;">/*Product Details goes here*/</td>
<td style="border:1px Dashed #bfbfbf;width: 192px;">/*Product Details goes here*/</td>
<td style="border:1px Dashed #bfbfbf;width: 192px;">/*Product Details goes here*/</td>
</tr>
...
...
...
</tbody>
</table>
现在,当我尝试实现angular js并动态加载我的产品时,我必须编写以下代码
<table style="border-collapse:collapse;width: 769px">
<tr>
<td ng-repeat="product in products" style="border:1px Dashed #bfbfbf;width:192px;colspan="4"";>
<ng-include src="product.FullDescription"></ng-include>
</td>
</tr>
</table>
这当然会创建单行,所有产品都在单行中。任何有想法使用ng重复的人,这样我就可以有多个tr
,每个tr
有4个tds
更新
这是我的控制器
angular.module('myApp', [])
.controller('NgProducts', function($scope) {
$scope.products=@Html.Raw(Json.Encode(Model.Products));//Model.products can contain any number of products.
// I want to load this every product in single td and also want to have mtliple tr with each tr having 4 tds
});
这个链接解决了我的问题
在tr 上使用ng-repeat="product in products"
像
<table style="border-collapse:collapse;width: 769px">
<tr ng-repeat="product in products">
<td style="border:1px Dashed #bfbfbf;width:192px;colspan="4"";>
<ng-include src="product.FullDescription"></ng-include>
</td>
</tr>
</table>
这是我正在构建的应用程序示例:
<tr ng-repeat="alldata in mydata.row | filter:search | orderBy:sortBy:reverse ">
<td><div>{{alldata.id | number}}</div></td>
<td>{{alldata.name | uppercase}}</td>
<td>{{alldata.numbers}}</td>
<td><a href="#/edit/{{alldata.id}}" class="btn btn-primary">Edit</a></td>
</tr>
它看起来与您的应用程序相似。
相关文章:
- 角度:在ng重复上切换图像
- 如何将函数包装在函数中以避免代码重复
- AngularJS:ng之后,重复$scope值未按预期更新
- Ajax聊天消息重复而不仅仅是更新
- 使用每次都不同的transclude重复指令
- 每当您在选择器内移动鼠标时,悬停功能就会重复
- 在javascript中搜索具有重复值的两个数组中的匹配值
- 正在获取生成的PHP td值
- 角度的项目列表 ng 重复,ng 单击显示全宽描述
- 如何在td元素中添加监听器
- 防止ng重复中的重复值(AngularJS)
- Meteor JS中代码的重复使用部分
- 从键值结构中获取数据,并将其与AngularJS中ng重复的值进行比较
- 在单个ng重复中创建多个td
- javascript选择td´s并计数重复项
- 重复一组<td>s使用AngularJS在同一表行中
- 有角度的ng用多个td重复tr
- 如何设置"data-title"& lt; td>不用重复使用angular数据表
- 角度ng重复在我放入td之前没有显示任何数据
- 如何检查td中select元素的重复项