3
The $http
has two examples. I would like you to help me because I don’t know which is the most useful
There is the :
var chamada = function () {
return $http.get('https:url/exemplo.json')
.then(function (response) {
return response.data;
});
}
and the :
var outraChamada = function () {
return $http.get('https:url/outroExemplo.json')
.success(function (data) {
return data;
}).error(function (status) {
return status;
})
}
What should I choose? Is there any way to return the date if it is changed in the Web Service (without calling the function)?
"Is there any way to give me back the date if it is changed in the Web Service (without having to call the function)?" Are you saying something magical, where he would update himself without calling the web service? If that’s it, no, there’s no magic to it yet(not ready).
– DH.
success
anderror
are callbacks marked as deprecated, use then. Source: https://docs.angularjs.org/api/ng/service/$http– OnoSendai