// Simple GET request example:
$http({
method: ‘GET’,
url: ‘/someUrl’
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
$scope.user = data;
console.log(data);
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
var data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
$scope.user = data;
console.log(data);
});
More Details:
https://docs.angularjs.org/api/ng/service/$http