I am currently trying to display array data in a table using angular. Here is my HTML:
<table>
<thead>
<tr>
<th>Location</th>
<th>User</th>
<th>Date</th>
<th>Time</th>
<th>Amount</th>
<th>Transaction Type</th>
<th>Direct Object</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in index.users">
<td ng-repeat="transaction in users.transactions">
{{transaction.transLocale}}</td>
<td>{{user.name}}</td>
<td>{{user.transDate}}</td>
<td>{{user.transTime}}</td>
<td>{{user.transAmount}}</td>
<td>{{user.transType}}</td>
<td>{{user.directObject}}</td>
</tr>
</tbody>
</table>
And here is my js:
app.controller('IndexController', function(){
this.users = userHistory;
});
var userHistory = [
{
name: 'Bobby',
transactions:
[{
transDate: '1/15/15',
transTime: '4:30pm',
directObject: 'Matt',
transAmount: '11',
transType: 'debt',
transLocale: 'B-dubs'
},{
transDate: '1/12/15',
transTime: '7:30pm',
directObject: 'Matt',
transAmount: '9',
transType: 'credit',
transLocale: 'MickDs'
}]
},
{ name: 'Jake',
transactions: [
{
transDate: '1/11/15',
transTime: '1:30pm',
directObject: 'Matt',
transAmount: '5',
transType: 'credit',
transLocale: "Jason's"
}, {
transDate: '1/12/15',
transTime: '7:30pm',
directObject: 'Matt',
transAmount: '9',
transType: 'debt',
transLocale: 'MickDs'
}]
},
{
name: 'Clayton',
transactions: {
transDate: '1/14/15',
transTime: '2:30pm',
directObject: 'Matt',
transAmount: '15',
transType: 'credit',
transLocale: "Chen's"
}
}];
I can't seem to print the data inside of the transactions array? I am just starting out in angular so I am not quite sure what is going on. Any insight would be wonderful, I am trying to learn more than trying to get it to work. Thanks!
transaction{{transaction.transDate}}. Change others similarly