在AngularJS中绘制一个矩阵数组
我需要根据以下数组用AngularJS绘制一个表在AngularJS中绘制一个矩阵数组,angularjs,Angularjs,我需要根据以下数组用AngularJS绘制一个表 $scope.list = [ { "Row":1, "Column": 1, "Value": "11" }, { "Row":1, "Column": 2, "Value": "12" }, { "Row":1, "Column": 3, "Value": "13" }, { "Row":2, "Column": 1, "Value": "21" }, { "Row":2, "Column": 2, "Value": "22" }, { "R
$scope.list = [
{ "Row":1, "Column": 1, "Value": "11" },
{ "Row":1, "Column": 2, "Value": "12" },
{ "Row":1, "Column": 3, "Value": "13" },
{ "Row":2, "Column": 1, "Value": "21" },
{ "Row":2, "Column": 2, "Value": "22" },
{ "Row":2, "Column": 3, "Value": "23" },
];
所以我需要得到一个2行3列的表
我知道我必须使用两个嵌套的ngRepeat,但我无法使它工作
你能帮我吗??
关于您应该首先将数组转换为这样的数组:
$scope.table = [
["11", "12", "13"],
["21", "22", "23"],
];
这样,迭代视图中的值会更容易:
<table>
<tr ng-repeat="row in table">
<td ng-repeat="column in row">
{{column}}
</td>
</tr>
</table>
{{column}}
您应该首先将数组转换为这样的数组:
$scope.table = [
["11", "12", "13"],
["21", "22", "23"],
];
这样,迭代视图中的值会更容易:
<table>
<tr ng-repeat="row in table">
<td ng-repeat="column in row">
{{column}}
</td>
</tr>
</table>
{{column}}
您应该首先将数组转换为这样的数组:
$scope.table = [
["11", "12", "13"],
["21", "22", "23"],
];
这样,迭代视图中的值会更容易:
<table>
<tr ng-repeat="row in table">
<td ng-repeat="column in row">
{{column}}
</td>
</tr>
</table>
{{column}}
您应该首先将数组转换为这样的数组:
$scope.table = [
["11", "12", "13"],
["21", "22", "23"],
];
这样,迭代视图中的值会更容易:
<table>
<tr ng-repeat="row in table">
<td ng-repeat="column in row">
{{column}}
</td>
</tr>
</table>
{{column}}
我开发了解决方案,发现了一个“唯一”过滤器对于每个唯一的行号,我得到列列表
<table border="2">
<tr ng-repeat="row in list | unique:'Row'">
<td>Row: {{row.Row}}</td>
<td ng-repeat="col in list | filter:{'Row':row.Row}">{{col.Value}}</td>
</tr>
</table>
行:{{Row.Row}
{{col.Value}}
我开发了解决方案,发现了一个“唯一”过滤器对于每个唯一的行号,我得到列列表
<table border="2">
<tr ng-repeat="row in list | unique:'Row'">
<td>Row: {{row.Row}}</td>
<td ng-repeat="col in list | filter:{'Row':row.Row}">{{col.Value}}</td>
</tr>
</table>
行:{{Row.Row}
{{col.Value}}
我开发了解决方案,发现了一个“唯一”过滤器对于每个唯一的行号,我得到列列表
<table border="2">
<tr ng-repeat="row in list | unique:'Row'">
<td>Row: {{row.Row}}</td>
<td ng-repeat="col in list | filter:{'Row':row.Row}">{{col.Value}}</td>
</tr>
</table>
行:{{Row.Row}
{{col.Value}}
我开发了解决方案,发现了一个“唯一”过滤器对于每个唯一的行号,我得到列列表
<table border="2">
<tr ng-repeat="row in list | unique:'Row'">
<td>Row: {{row.Row}}</td>
<td ng-repeat="col in list | filter:{'Row':row.Row}">{{col.Value}}</td>
</tr>
</table>
行:{{Row.Row}
{{col.Value}}
首先按行对项目进行分组?我建议您预处理此数组并将其拆分为二维数组,看起来有点像:[['11'、'12'、'13']、['21'、'22'、'23']
。这应该不难用基本的JS知识来完成。我的想法是使用我的数组,因为它将有更多的信息来显示您的项目,首先按行分组?。我建议您预处理此数组并将其拆分为2D数组,看起来有点像:[[['11'、'12'、'13']、['21'、'22'、'23']
。这应该不难用基本的JS知识来完成。我的想法是使用我的数组,因为它将有更多的信息来显示您的项目,首先按行分组?。我建议您预处理此数组并将其拆分为2D数组,看起来有点像:[[['11'、'12'、'13']、['21'、'22'、'23']
。这应该不难用基本的JS知识来完成。我的想法是使用我的数组,因为它将有更多的信息来显示您的项目,首先按行分组?。我建议您预处理此数组并将其拆分为2D数组,看起来有点像:[[['11'、'12'、'13']、['21'、'22'、'23']
。这应该不难用基本的JS知识来完成。想法是使用my array,因为它将有更多的信息显示想法是使用my array,因为它将有更多的信息使用my array想法是使用my array,因为它将有更多的信息使用my array,因为它会有更多的infomration这个想法是使用我的数组,因为它会有更多的infomration