diff options
| author | Matt Ginzton | 2013-12-30 16:02:32 -0800 | 
|---|---|---|
| committer | Igor Minar | 2013-12-31 01:17:43 -0800 | 
| commit | 186a5912288acfff0ee59dae29af83c37c987921 (patch) | |
| tree | e4d1c1f5d1bdda872f157e41a2c5160e3669478a | |
| parent | a80049fd0ac858eeeb645a4209cb2a661d0b4c33 (diff) | |
| download | angular.js-186a5912288acfff0ee59dae29af83c37c987921.tar.bz2 | |
fix($injector): remove INSTANTIATING entry when done
getService flags services as INSTANTIATING while it calls their
provider factory, in order to detect circular dependencies. If
the service is instantiated correctly, the INSTANTIATING flag is
overwritten with the actual service. However, if the service is
not instantiated correctly, the INSTANTIATING flag should still
be removed, or all further requests for this service will be
mis-detected as a circular dependency.
Closes #4361
Closes #5577
| -rw-r--r-- | src/auto/injector.js | 5 | 
1 files changed, 5 insertions, 0 deletions
| diff --git a/src/auto/injector.js b/src/auto/injector.js index 4d4b1b93..a04ff1e6 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -740,6 +740,11 @@ function createInjector(modulesToLoad) {            path.unshift(serviceName);            cache[serviceName] = INSTANTIATING;            return cache[serviceName] = factory(serviceName); +        } catch (err) { +          if (cache[serviceName] === INSTANTIATING) { +            delete cache[serviceName]; +          } +          throw err;          } finally {            path.shift();          } | 
