0
Ich möchte HTTP-Antwort (JSON-Antwort) auf HTML-Seite in einer Tabelle anzeigen. Um dies zu erreichen, schrieb ich unter Controller-Funktion.
$scope.getSensorInfo=function(){
var strippeddata = [];
$http({
method: "GET",
url: "http://xx.xx.xx.xx:4000/config",
params: {did: $scope.cid}
}).then(function (success) {
if (success.data[0] === undefined) { //no device is available with this id
$http({
method: "GET",
url: "http://xx.xx.xx.xx:4000/info"
}).then(function(success1){
$scope.sinfo = success1.data;
},function(error1){
console.log('Error ' + JSON.stringify(error1));
});
} else {
Object.getOwnPropertyNames(success.data[0].obj).forEach(function (item, idx, list) {
Object.defineProperty(strippeddata, idx, {
enumerable: true,
configurable: true,
get: function() {
return {
name: item,
periodicity: success.data[0].obj[item].periodicity,
}
}
});
});
$scope.sinfo = strippeddata;
}
}, function (error) {
console.log('Error ' + JSON.stringify(error));
});
}
Mein HTML-Code ist wie folgt.
Wenn ich diesen Code ausführe bekomme ich $ Digest 10 Iterationen erreicht Abbruchfehler. Die folgende Zeile verursacht das Problem, aber ich kann es nicht beheben.
$scope.sinfo = strippeddata;