diff options
| author | Vojta Jina | 2013-10-16 12:14:44 -0700 |
|---|---|---|
| committer | Igor Minar | 2013-10-18 15:26:51 -0700 |
| commit | c22adbf160f32c1839fbb35382b7a8c6bcec2927 (patch) | |
| tree | 3e4937b777958f1c4c0c9300e4065805a06ae29c /src/auto/injector.js | |
| parent | dba566a96d3c660e12249dcb6445dad19854da97 (diff) | |
| download | angular.js-c22adbf160f32c1839fbb35382b7a8c6bcec2927.tar.bz2 | |
fix($injector): allow a constructor function to return a function
This change makes `$injector.instantiate` (and thus `$provide.service`) to behave the same as native
`new` operator.
Diffstat (limited to 'src/auto/injector.js')
| -rw-r--r-- | src/auto/injector.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/auto/injector.js b/src/auto/injector.js index 482c8861..3676ee59 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -759,7 +759,7 @@ function createInjector(modulesToLoad) { instance = new Constructor(); returnedValue = invoke(Type, instance, locals); - return isObject(returnedValue) ? returnedValue : instance; + return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance; } return { |
