AngularJS × Rollbar JS API
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 3 commits behind anotherpit:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A tiny Angular wrapper for for Rollbar JS API

    var module = angular.module('', ['ng', 'anotherpit/angular-rollbar']);

    module.config(['$rollbarProvider', function($rollbarProvider) {
        // Be sure to replace POST_CLIENT_ITEM_ACCESS_TOKEN with your project's post_client_item access token, which you can find in the interface.
        $rollbarProvider.config.accessToken = 'POST_CLIENT_ITEM_ACCESS_TOKEN';
        $rollbarProvider.config.captureUncaught = true;
        $rollbarProvider.config.payload = {
            environment : 'production'
    }]);['$rollbar', function($rollbar) {
        // Caught errors
        try {
        } catch (e) {
          $rollbar.error("Something went wrong", e);

        // Arbitrary log messages. 'critical' is most severe; 'debug' is least.
        $rollbar.critical("Connection error from remote Payments API");
        $rollbar.error("Some unexpected condition");
        $rollbar.warning("Connection error from Twitter API");
        $"User opened the purchase dialog");
        $rollbar.debug("Purchase dialog finished rendering");

        // Can include custom data with any of the above.
        // It will appear as `custom.postId` in the Occurrences tab
        $"Post published", {postId: 123});

        // Callback functions
        $rollbar.error(e, function(err, data) {
          if (err) {
            console.log("Error while reporting error to Rollbar: ", e);
          } else {
            console.log("Error successfully reported to Rollbar. UUID:", data.uuid);