This example shows how you can use the Bugsnag JavaScript notifier with Angular 2+.
Whilst the notifier reports any errors that are uncaught, there are certain errors
within Angular that get caught by its own error handler and only logged to the console.
These errors will never make it to Bugsnag by themselves and so require a little
wiring up. This is where the bugsnag-angular
plugin steps in…
This project was generated with Angular CLI version 1.3.0. Run ng serve
for a dev server and navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Try this out with your own Bugsnag account! You'll be able to see how the errors are reported in the dashboard, how breadcrumbs are left, how errors are grouped and how they relate to the original source.
To get set up, follow the instructions below. Don't forget to replace the placeholder API token with your own!
- Clone the repo and
cd
this this directory:git clone https://github.com/bugsnag/bugsnag-angular.git cd bugsnag-angular/example
- Install the dependencies (with either npm or yarn):
npm i
yarn
- Replace the
API_KEY
placeholder in bugsnag.ts with your actual API key. - Build the application and start the development web server:
npm start
- View the example page which will (most likely) be served at: http://localhost:4200/