Integrate AirBrake into an angular.js application
bower install ng-helper-airbrake --save
Ensure that the dependency entry comes directly after the angular dependency. Are you not sure? Check & modify the bower.json.
angular.module('appApp', [
'ngHelperAirbrake'
]);
Airbrake requires a project id and secret. This can be configured via the application config function as follows:
.config([ '$airbrakeProvider', function($airbrakeProvider) {
// configure airbrake
$airbrakeProvider.setProject('<<PROJECTID>>', '<<PROJECTSECRET>>', '<<EnvironmentOptional>>');
// configure host (optional step for self hosted environments)
$airbrakeProvider.setHost('https://yourdomain.com');
}]);
The Airbrake plugin is not available as long the setProject method is not called. Only when this method is called exception will be catched from the subsystem.
.run([ '$airbrake', function($airbrake) {
// add custom context
$airbrake.setCustomContext({custom1: "context1", custom2: "context2" });
}]);
You can add optional custom information to the error context via the setCustomContext function.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :)