Skip to content

Instantly share code, notes, and snippets.

@roelentless
roelentless / angular.app.store.errors.js
Created March 18, 2016 13:47
Put all $log errors in a global variable "errors" so you have a log of errors that happen before you have access to the console.
angular
.module('app', [])
.config(['$provide', function ($provide) {
window.errors = [];
$provide.decorator('$log', ['$delegate', function ($delegate) {
var origError = $delegate.error;
$delegate.error = function () {
window.errors.push(arguments);
origError.apply(null, arguments);