I have the following JSON:
{
"records":[
{
"TrackID":"4",
"ownerID":"14",
"name":"Test1",
"minTime":"2015-04-08T16:50:51Z",
"maxTime":"2015-04-08T17:26:39Z",
"tracks":[
{
"lat":"53.3996905",
"long":"-2.92532816666667",
"time":"2015-04-20T06:34:46Z",
"hour":6
},
{
"lat":"53.3997495",
"long":"-2.92545483333333",
"time":"2015-04-20T06:35:01Z",
"hour":6
},
{
"lat":"53.4008018333333",
"long":"-2.9253085",
"time":"2015-04-20T06:35:13Z",
"hour":6
}
]
}
]
}
and I'm trying to output each "ownerID", then each "lat" and "long" associated with the ownerID. I'm using the following:
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("path to json")
.success(function (response) {
$scope.dataModel = response.records;
});
});
and then (HTML)
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="trackInfo in dataModel">
<td>
{{ trackInfo.ownerID}}
</td>
</tr>
<tr ng-repeat="trackDetails in trackInfo">
<td>
{{ trackDetails.lat }}
</td>
</tr>
</table>
</div>
It outputs the ownerID's but not the tracks?? Has anyone any idea why please? Thanks...
trackInfo
variable only exists inside the firstng-repeat
.