diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f6ccd62..15e3a178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/lib/src/core/injection.dart b/lib/src/core/injection.dart index dd14e81b..4db5c9ca 100644 --- a/lib/src/core/injection.dart +++ b/lib/src/core/injection.dart @@ -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)