I'm exploring how jhipster manipulates data. I have found $http.get()
in getProfileInfo
method in ProfileService
Service whitch interacting restful api
:
function getProfileInfo() {
if (!angular.isDefined(dataPromise)) {
dataPromise = $http.get('api/profile-info').then(function(result) {
if (result.data.activeProfiles) {
var response = {};
response.activeProfiles = result.data.activeProfiles;
response.ribbonEnv = result.data.ribbonEnv;
response.inProduction = result.data.activeProfiles.indexOf("prod") !== -1;
response.swaggerDisabled = result.data.activeProfiles.indexOf("no-swagger") !== -1;
return response;
}
});
}
return dataPromise;
}
and some where i have found $resouce()
manipulating GET
method. for example in BankAccount
factory :
var resourceUrl = 'api/bank-accounts/:id';
I searched for when to use $http
and when to use $resource
and i found this :
why hipster
is not following consistent
way of interacting API and manipulating data!!?
so jhipster
, when to use $http
and when to use $resource
in services??