I'm trying to get only a value of HTTP
return but I'm not getting it.
.controller('myCtrl', function ($scope, $http) {
$scope.sendPost = function() {
var dataObj = {
name : $scope.newName
};
var res = $http.post('xxxx.consulta.php', dataObj)
res.success(function(data, status, headers, config) {
$scope.hello = data;
});
}
})
When I run the page in the browser it returns me the object JSON
:
[{"id":"13","nome":"Yuri","departamento":"EAD","img":"https:\/\/image.freepik.com\/icones-gratis\/perfil-macho-utilizador-sombra_318-40244.png"}]
I would like to save only the id and name, how do I? Already tried
data.id
or view
{{hello.id}}
and did not work ...