@Ionicoser wrote:
Hi all,
while im checking my code i found some difference usings of $http.get() - Whats the correct way?
1:
var getProfiles = function () { var deferred = $q.defer(); $http.get(cordova.file.dataDirectory + theFile) .success(function(data, status, headers, config) { deferred.resolve(data); }) .error(function(data, status, headers, config) { deferred.reject({status: "ERROR"}); }); return deferred.promise; }
2:
var getProfiles = function () { var deferred = $q.defer(); $http.get(cordova.file.dataDirectory + theFile).then( function(success) { deferred.resolve(success) }, function(error) { deferred.reject(error); } ); return deferred.promise; }
Posts: 1
Participants: 1