im currently reading out data from my MySql database with a PHP script and AngularSQL as w3school did it in their tutorial.
The readout is working fine and I can access the data with ng-repeat
. The data is currently saved in $scope.records as JSON data, however, I'm unable to print the data with JSON.stringify nor can I check if the data really is in JSON with
if (isJSON(data)){
//do some data stuff
}else{
//report the error
alert(data);
}
Here is my Code of the AngularJS stuff:
<table>
<tr ng-repeat="x in records">
<td>{{ x.Timestamp }}</td>
<td>{{ x.PT1 }}</td>
</tr>
</table>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://localhost/tests/dataconn.php")
.then(function (response) {$scope.records = response.data.records;});
});
</script>
Does anybode know, how I can access the $scope.records stuff, without "ng-repeat"? I need to transfer the data to an JS array.