As state by the Angular 1.5 document
The $http legacy promise methods success and error have been deprecated. Use the standard then method instead. If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error.
The $http service always returns promise, but prior to 1.4X you had the success and error methods that were shotcuts of the promise.then(success, error).
Besides that, the promise notation is really better because of the power of chaining promises, something that is not that elegant using callbacks notation. Something like:
utility.getData().then(function(){
return utility.getMoreData();
}).then(function(response){
//do something if the data from second call
}).catch(function(err){
//something was wrong with one of the calls
});
With single calls, you may not see any advantage, but promises are really good to prevent de Callback-hell
Besides that, your utility service should return de $http promise, you don't need the $q. Something like:
this.getData= function(url){
return $http({method: 'GET', url: url});
};
If you realy want to manipulate the data before the call, you can again use the power of promise:
this.getData= function(url){
return $http({method: 'GET', url: url}).then(function(response){
data = processData(response);
return data;
});
};
the data will be available to the then function on the caller.