{ "html": "
\n

Installation

\n

Raven.js and the Raven.js Angular plugin are distributed using a few different methods.

\n
\n

Using our CDN

\n

For convenience, our CDN serves a single, minified JavaScript file containing both Raven.js and the Raven.js AngularJS plugin. It should be included after Angular, but before your application code.

\n

Example:

\n
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>\n<script src="https://cdn.ravenjs.com/3.20.1/angular/raven.min.js" crossorigin="anonymous"></script>\n<script>Raven.config('___PUBLIC_DSN___').install();</script>\n
\n
\n

Note that this CDN build auto-initializes the Angular plugin.

\n
\n
\n

Using package managers

\n

Pre-built distributions of Raven.js and the Raven.js AngularJS plugin are available via both Bower and npm.

\n
\n

Bower

\n
$ bower install raven-js --save\n
\n
\n
<script src="/bower_components/angular/angular.js"></script>\n<script src="/bower_components/raven-js/dist/raven.js"></script>\n<script src="/bower_components/raven-js/dist/plugins/angular.js"></script>\n<script>\n  Raven\n    .config('___PUBLIC_DSN___')\n    .addPlugin(Raven.Plugins.Angular)\n    .install();\n</script>\n
\n
\n
\n
\n

npm

\n
$ npm install raven-js --save\n
\n
\n
<script src="/node_modules/angular/angular.js"></script>\n<script src="/node_modules/raven-js/dist/raven.js"></script>\n<script src="/node_modules/raven-js/dist/plugins/angular.js"></script>\n<script>\n  Raven\n    .config('___PUBLIC_DSN___')\n    .addPlugin(Raven.Plugins.Angular)\n    .install();\n</script>\n
\n
\n

These examples assume that AngularJS is exported globally as window.angular. You can alternatively pass a reference to the angular object directly as the second argument to addPlugin:

\n
Raven.addPlugin(Raven.Plugins.Angular, angular);\n
\n
\n
\n
\n
\n

Module loaders (CommonJS)

\n

Raven and the Raven AngularJS plugin can be loaded using a module loader like Browserify or Webpack.

\n
var angular = require('angular');\nvar Raven = require('raven-js');\n\nRaven\n  .config('___PUBLIC_DSN___')\n  .addPlugin(require('raven-js/plugins/angular'), angular)\n  .install();\n
\n
\n

Note that when using CommonJS-style imports, you must pass a reference to angular as the second argument to addPlugin.

\n
\n
\n", "link": "https://docs.getsentry.com/clients/javascript/integrations/angularjs/", "id": "javascript-angularjs", "name": "AngularJS" }