We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 35d4993 commit 44b6b72Copy full SHA for 44b6b72
1 file changed
src/auto/injector.js
@@ -52,13 +52,15 @@ function annotate(fn) {
52
if (typeof fn == 'function') {
53
if (!($inject = fn.$inject)) {
54
$inject = [];
55
- fnText = fn.toString().replace(STRIP_COMMENTS, '');
56
- argDecl = fnText.match(FN_ARGS);
57
- forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
58
- arg.replace(FN_ARG, function(all, underscore, name){
59
- $inject.push(name);
+ if (fn.length) {
+ fnText = fn.toString().replace(STRIP_COMMENTS, '');
+ argDecl = fnText.match(FN_ARGS);
+ forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
+ arg.replace(FN_ARG, function(all, underscore, name){
60
+ $inject.push(name);
61
+ });
62
});
- });
63
+ }
64
fn.$inject = $inject;
65
}
66
} else if (isArray(fn)) {
0 commit comments