Reputation: 393
I have an array inside of my controller that I'm tried to iterate into a table inside of my view template. Inside of the console, I can see the array objects but inside my table, I only see the rows without the data being displayed.
HTML Template:
<div class="availability-list-table" ng-controller="InventoryController">
<table class="table availability-table">
<tbody>
<tr ng-repeat="item in items">
<td>{{items.qty}}</td>
<td>{{items.item}}</td>
</tr>
</tbody>
</table>
Controller:
app.controller('InventoryController', ['$scope', function($scope) {
$scope.items = [
{
item: 'Blue Moon Pint',
qty: 50,
},
{
item: 'Bud Light Pint',
qty: 50,
},
{
item: 'Sprite',
qty: 30,
},
{
item: 'Coke',
qty: 100
}
];
}]);
Upvotes: 0
Views: 99
Reputation: 163362
You are looping through items: item in items
.
Try item.qty
and item.item
instead:
<div class="availability-list-table" ng-controller="InventoryController">
<table class="table availability-table">
<tbody>
<tr ng-repeat="item in items">
<td>{{item.qty}}</td>
<td>{{item.item}}</td>
</tr>
</tbody>
</table>
Upvotes: 1