Skip to content

Instantly share code, notes, and snippets.

@pcbulai
Created October 26, 2015 10:58
Show Gist options
  • Save pcbulai/981b573bb44956c8b908 to your computer and use it in GitHub Desktop.
Save pcbulai/981b573bb44956c8b908 to your computer and use it in GitHub Desktop.
Detect failing function on a minified Angular JS script.
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;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment