Created
March 18, 2016 13:47
-
-
Save roelentless/d330b9cad05a6a43cd09 to your computer and use it in GitHub Desktop.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}; | |
return $delegate; | |
}]); | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment