# Usage with Angular

Integration with Angular is as simple as adding an
[$exceptionHandler](https://docs.angularjs.org/api/ng/service/$exceptionHandler):

```js
mod.factory('$exceptionHandler', function ($log) {
  var airbrake = new airbrakeJs.Client({
    projectId: 1,       // Airbrake project id
    projectKey: 'FIXME' // Airbrake project API key
  });
  airbrake.addFilter(function (notice) {
    notice.context.environment = 'production';
    return notice;
  });

  return function (exception, cause) {
    $log.error(exception);
    airbrake.notify({error: exception, params: {angular_cause: cause}});
  };
});
```

# Usage with Angular

Integration with Angular is as simple as adding an
[$exceptionHandler](https://docs.angularjs.org/api/ng/service/$exceptionHandler):

```js
angular
  .module('app')
  .factory('$exceptionHandler', function ($log) {
    var airbrake = new airbrakeJs.Client({
      projectid: 1,       // Airbrake project id
      projectkey: 'FIXME' // Airbrake project API key
    });

    airbrake.addFilter(function (notice) {
      notice.context.environment = 'production';
      return notice;
    });

    return function (exception, cause) {
      $log.error(exception);
      airbrake.notify({error: exception, params: {angular_cause: cause}});
    };
  });
```

Use consistent style for AngularJS code example
Use consistent style for AngularJS code example

https://github.com/johnpapa/angular-styleguide/tree/7019503f2c8a637d1a70f5719cb17b9669653565/a1
