<td>{{row.sku}}</td>
<td>{{row.name}}</td>
<td>{{row.type}}</td>
<td>{{row.category.label}}</td>
<td class="text-center">{{row.price | currency : "€"}}</td>
<td>{{row.description}}</td>
<td>{{row.state}}</td>
<td class="text-center">{{row.amount}}</td>
我希望用这样的东西改变这个东西
<td ng-repeat="row in displayed">{{row.[value]}}</td>
如果有办法,你可以建议我吗?
答案 0 :(得分:1)
您可以按照以下方式执行此操作:
<table>
<tr ng-repeat="row in vm.array">
<td ng-repeat="(key,value) in row ">{{value}}</td>
</tr>
</table>
此处为plunkr
答案 1 :(得分:0)
请参阅以下简单示例。 demo plnkr
angular.module("myApp",[])
.controller("MyController", function($scope) {
$scope.displayed = [
{"one":"one", "two":"two", "three":"three"},
{"one":"1", "two":"2", "three":"3"}];
})
<html ng-app="myApp">
<head>
<script data-require="angular.js@1.4.7" data-semver="1.4.7" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<h1>Test table</h1>
<table ng-controller="MyController">
<tr ng-repeat="row in displayed">
<td ng-repeat="(key,value) in row">{{row[key]}}</td>
</tr>
</table>
</body>
</html>