Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Latest commit

 

History

History
67 lines (43 loc) · 2.68 KB

Readme.md

File metadata and controls

67 lines (43 loc) · 2.68 KB

Deprecation notice

We upgraded our Angular support in the latest all-in-one javascript notifier package. Check out the blog post for more info.

All projects should upgrade to our universal JS notifier: @bugsnag/js and use the new version of the Angular plugin: @bugsnag/plugin-angular. See the upgrade guide for details on how to upgrade.

This package is now deprecated, but will continue to exist on the npm registry and work with Bugsnag's API for the foreseeable future. However, it will no longer receive updates unless they are critical.

Please upgrade at your earliest convenience.


Bugsnag: Angular

A bugsnag-js plugin for Angular.

This package enables you to integrate Bugsnag's error reporting with an Angular (v2+) application at a detailed level. It provides an implementation of the @angular/core ErrorHandler which you can use to capture and report unhandled errors in your app.

Reported errors will contain useful debugging info from Angular's internals, such as the component and context.

Installation

npm i --save bugsnag-js bugsnag-angular
# or
yarn add bugsnag-js bugsnag-angular

Usage

In your the root of your angular app, typically app.module.ts:

// Import bugsnag-js and bugsnag-angular
import BugsnagErrorHandler from 'bugsnag-angular'
import bugsnag from 'bugsnag-js'

// configure Bugsnag ASAP, before any other imports
const bugsnagClient = bugsnag('API_KEY')

// create a factory which will return the bugsnag error handler
export function errorHandlerFactory() {
  return new BugsnagErrorHandler(bugsnagClient)
}

import { ErrorHandler, NgModule } from '@angular/core'
// ... other imports omitted for brevity

@NgModule({
  /* Pass the BugsnagErrorHandler class along to the providers for your module */
  providers: [ { provide: ErrorHandler, useFactory: errorHandlerFactory } ]
  /* other properties passed to the decorator omitted for brevity */
})

See the example for more info.

Support

License

The Bugsnag JS library and official plugins are free software released under the MIT License. See LICENSE.txt for details.