1

I an writing an app with AngularJS 1.5.3. I've got a service with a $http.post request.

        employeeService.request = function () {
            var deferred = $q.defer();

            $http.post('myEndpoint')
                .then(function (data) {
                    deferred.resolve(items);
                })
                .catch(function (error) {
                    ErrorService.logDebugError(error, 'request');
                    deferred.reject(error);
                });

            return deferred.promise;
        };

If I want to catch my error in the catch block and not propagate it to the controller do I still need to reject the deferred promise and then just not do anything in the controller?

e.g

$http.post().then().catch( show error messages )
user1261710
  • 2,539
  • 5
  • 41
  • 72

0 Answers0