Vote count:
0
I want to read the json string, but its seems like $http.get() only work when i passing the json file not the json string.I want to pass sql result as json string. Please guide me how to get this right.
Ps. Sorry for my english.
var i = 0;
$scope.refreshData = function(){ $scope.myData = [];
var start = new Date();
var sec = $interval(function () {
$scope.callsPending++;
$http.get(JSON.parse('[{"id": "0","age": "30","name": "Don"}]'))
.success(function(data) {
$scope.callsPending--;
data.forEach(function(row){
row.name = "Izi";
row.id = i;
i++;
$scope.myData.push(row);
});
})
.error(function() {
$scope.callsPending--
});
}, 200);
$timeout(function() {
$interval.cancel(sec);
$scope.left = '';
}, 2000);
};
asked 1 min ago
JSON string cannot be read
Aucun commentaire:
Enregistrer un commentaire