Ich habe ein Array von Objekten, ich möchte eine Tabelle mit ng-repeat erstellen, die Daten in die richtigen Spalten einfügen wird.AngularJS Vertikale Tabelle mit ng-repeat
Im Moment mache ich es so und ich kann es nicht richtig bekommen.
Bitte sehen Plunker for more details
<div class container>
<div class="row">
<div class="col-md-12">
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<th>Time()</th>
<th>Room - One</th>
<th>Room - Two</th>
<th>Room - Three</th>
<th>Room - Four</th>
</tr>
<tr ng-repeat="company in dataOne track by $index">
<td>{{company.start}} - {{company.end}}</td>
<td>{{company.company}}</td>
<td>{{company.company}}</td>
<td>{{company.company}}</td>
<td>{{company.company}}</td>
</tr>
</table>
</div>
</div>
</div>
Beispieldaten
$scope.dataOne = [{
"start": "7:30",
"end": "8:00",
"company": "Sony"
}, {
"start": "7:30",
"end": "8:00",
"company": "LG"
}, {
"start": "7:30",
"end": "8:00",
"company": "UPS"
}, {
"start": "7:30",
"end": "8:00",
"company": "MSI"
}, {
"start": "8:00",
"end": "8:30",
"company": "Samsung"
}, {
"start": "8:00",
"end": "8:30",
"company": "Tesco"
}, {
"start": "8:00",
"end": "8:30",
"company": "VW"
}, {
"start": "8:00",
"end": "8:30",
"company": "Audi"
}, {
"start": "9:00",
"end": "9:30",
"company": "BMW"
}, {
"start": "9:00",
"end": "9:30",
"company": "Sunoco"
}, {
"start": "9:00",
"end": "9:30",
"company": "Blizzard"
}, {
"start": "9:00",
"end": "9:30",
"company": "CS"
}, {
"start": "9:30",
"end": "10:00",
"company": "Mazda"
}, {
"start": "9:30",
"end": "10:00",
"company": "Nissan"
}, {
"start": "9:30",
"end": "10:00",
"company": "Porsche"
}, {
"start": "9:30",
"end": "10:00",
"company": "Hyundai"
}]
console.log($scope.dataOne)
Was ist Ihr '$ scope.dataOne' aussehen? – Ryan27
Beispieldaten sind im Plocker enthalten Bitte sehen Sie –
Sie können verschachtelte 'ng-repeat' verwenden, wenn das Datenfeld nicht zu lang ist –