diff options
| -rw-r--r-- | src/auto/injector.js | 2 | ||||
| -rw-r--r-- | test/auto/injectorSpec.js | 7 | 
2 files changed, 8 insertions, 1 deletions
diff --git a/src/auto/injector.js b/src/auto/injector.js index 1844db2a..1a1fcc27 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -38,7 +38,7 @@   * Implicit module which gets automatically added to each {@link angular.module.AUTO.$injector $injector}.   */ -var FN_ARGS = /^function\s*[^\(]*\(([^\)]*)\)/m; +var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;  var FN_ARG_SPLIT = /,/;  var FN_ARG = /^\s*(_?)(.+?)\1\s*$/;  var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js index 16cf1524..83bd3d1f 100644 --- a/test/auto/injectorSpec.js +++ b/test/auto/injectorSpec.js @@ -160,6 +160,13 @@ describe('injector', function() {      }); +    it('should handle no arg functions with spaces in the arguments list', function() { +      function fn( ) {} +      expect(inferInjectionArgs(fn)).toEqual([]); +      expect(fn.$inject).toEqual([]); +    }); + +      it('should handle args with both $ and _', function() {        function $f_n0($a_) {}        expect(inferInjectionArgs($f_n0)).toEqual(['$a_']);  | 
