mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
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
This commit is contained in:
parent
a80049fd0a
commit
186a591228
1 changed files with 5 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue