Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

lcarva/ng-http-error-interceptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated

This repository is no longer maintained.

ng-http-error-interceptor

Trigger events on any response error for Angular.

Manual

This interceptor broadcasts two events upon error responses:

  • http-error - triggered regardless of HTTP response status code.
    $rootScope.$on('http-error', function(response) {
      // Executes on every HTTP response error.
    });
  • http-error-XXX - triggered only if HTTP response status code matches XXX (404, 500, etc).
    $rootScope.$on('http-error-403', function(response) {
      // Executes on every HTTP response that errors due to a 403 status code.
    });

To bypass interceptor, set httpErrorInterceptor flag to false.

    $http.get('/spam', { httpErrorInterceptor: false });

Examples

See specs for usage example.

About

Trigger events on any response error for Angular.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published