From 186a5912288acfff0ee59dae29af83c37c987921 Mon Sep 17 00:00:00 2001 From: Matt Ginzton Date: Mon, 30 Dec 2013 16:02:32 -0800 Subject: 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 --- src/auto/injector.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/auto/injector.js') 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(); } -- cgit v1.2.3