Skip to content

Instantly share code, notes, and snippets.

@iamdevlinph
Last active July 11, 2017 07:37
Show Gist options
  • Save iamdevlinph/fef6b730fee2a66ead1c45cef7196743 to your computer and use it in GitHub Desktop.
Save iamdevlinph/fef6b730fee2a66ead1c45cef7196743 to your computer and use it in GitHub Desktop.
Angular - find cause of "[$Injector:unpr] Unknown provider: eProvider <- e" when minified
// Just a tip for ppl debugging such issues in 1.2 -
// This is a short snippet I wrote that will print an error to the console with the contents of the guilty (minified) function.
// All you need to do is put a breakpoint before angular bootstraps, paste the snippet in the console and release the debugger.
Object.defineProperty(Function.prototype, '$inject', {
configurable: true,
get: function() {
return this.$injectHooked;
},
set: function (arr) {
if (arr.length && arr[0].length < 3) {
console.error('missing @ngInject:', this);
}
return this.$injectHooked = arr;
}
});
// Source https://github.com/angular/angular.js/issues/4504#issuecomment-56023595
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment