AngularJS 1.x
If you're using AngularJS 1.x, you can use Sentry's AngularJS integration.
Install
Install @sentry/browser and @sentry/integrations using yarn or npm:
Copied
# Using yarn
yarn add @sentry/browser @sentry/integrations
# Using npm
npm install --save @sentry/browser @sentry/integrationsand afterwards using it like this:
Copied
import angular from "angular";
import * as Sentry from "@sentry/browser";
import { Angular as AngularIntegration } from "@sentry/integrations";
// Make sure to call Sentry.init after importing AngularJS.
// You can also pass {angular: AngularInstance} to the Integrations.Angular() constructor.
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [new AngularIntegration()],
});
// Finally require ngSentry as a dependency in your application module.
angular.module("yourApplicationModule", ["ngSentry"]);If you're using the CDN version of the SDK, Sentry provides a standalone file for every integration:
Copied
<script
src="https://browser.sentry-cdn.com/5.25.0/bundle.min.js"
integrity="sha384-2p7fXoWSRPG49ZgmmJlTEI/01BY1LgxCNFQFiWpImAERmS/bROOQm+cJMdq/kmWS"
crossorigin="anonymous"
></script>
<!-- If you include the integration it will be available under Sentry.Integrations.Angular -->
<script
src="https://browser.sentry-cdn.com/5.25.0/angular.min.js"
crossorigin="anonymous"
></script>
<script>
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [new Sentry.Integrations.Angular()],
});
</script>You can edit this page on GitHub.
- Package:
- npm:@sentry/browser
- Version:
- 5.25.0
- Repository:
- https://github.com/getsentry/sentry-javascript