im currently using ionic framework for android and laravel why is that when my json data is with bracket is not being displayed
[{"name":"Steve","state":"CA"}]
this below works just fine
{"name":"Steve","state":"CA"}
here is my controller
.controller('TestController', function($scope, $http){
$http.get('http://192.168.10.33/api/data').then(function(resp){
console.log('Success', resp);
$scope.name = resp.data.name;
}, function (err){
console.error('ERROR',err);
}) })
i use
{{name}}
to display on html file the json data
Since your data (resp.data) is an array, not a single object, this line:
$scope.name = resp.data.name;
Should probably be
$scope.name = resp.data[0].name;