aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ginzton2013-12-30 16:02:32 -0800
committerIgor Minar2013-12-31 01:17:43 -0800
commit186a5912288acfff0ee59dae29af83c37c987921 (patch)
treee4d1c1f5d1bdda872f157e41a2c5160e3669478a
parenta80049fd0ac858eeeb645a4209cb2a661d0b4c33 (diff)
downloadangular.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.js5
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();
}