resolveInjection supports named injections
This commit is contained in:
parent
efbb09169a
commit
47261f0a08
2 changed files with 3 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
* Add `Angel.environment`.
|
||||
* Deprecated `app.isProduction` in favor of `app.environment.isProduction`.
|
||||
* Allow setting of `bodyAsObject`, `bodyAsMap`, or `bodyAsList` **exactly once**.
|
||||
* Resolve named singletons in `resolveInjection`.
|
||||
|
||||
# 2.0.0-alpha.24
|
||||
* Add `AngelEnv` class to `core`.
|
||||
|
|
|
@ -39,6 +39,8 @@ resolveInjection(requirement, InjectionRequest injection, RequestContext req,
|
|||
if (value == null && param.required != false) throw param.error;
|
||||
return value;
|
||||
} else if (requirement is String) {
|
||||
if (req.container.hasNamed(requirement))
|
||||
return req.container.findByName(requirement);
|
||||
if (req.params.containsKey(requirement)) {
|
||||
return req.params[requirement];
|
||||
} else if ((propFromApp = req.app.findProperty(requirement)) != null)
|
||||
|
|
Loading…
Reference in a new issue