@lazy not working with @autoinject
See original GitHub issueI’m submitting a bug report
- Library Version: 1.3.2
Please tell us about your environment:
-
Operating System: Windows 10
-
Node Version: 6.11.2
- NPM Version: 4.6.1
- JSPM OR Webpack AND Version JSPM 0.16.48 (reproduced with Aurelia CLI v0.31.1)
-
Browser: all
-
Language: TypeScript 2.4.2
Current behavior:
Constructor arguments decorated with @lazy
are injected with undefined
when class is @autoinject
ed. Code, live demo.
Expected/desired behavior:
-
What is the expected behavior?
@autoinject
and@lazy
should work well together. It probably was after #111 was merged. -
What is the motivation / use case for changing the behavior? I want to be able to do this:
@autoinject
export class Alert {
constructor(private i18n: I18N, @lazy(TemplatingEngine) private templatingEngine: () => TemplatingEngine) {
}
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Autofixture Constructer injection lazy loading - Stack Overflow
I am using autofixture in my unit tests and it is great the way that it works as an automocker. However I have...
Read more >Dependency Injection: Basics | Aurelia
Learn about how to leverage Aurelia's dependency injection container, the power behind all object creation in Aurelia applications.
Read more >Browser-level image lazy loading for the web - web.dev
This post covers the loading attribute and how it can be used to control the loading of images.
Read more >Contexts and Dependency Injection - Quarkus
It may happen that some beans from third-party libraries do not work correctly in ... normal scoped beans must be used as described...
Read more >Service Container - The PHP Framework For Web Artisans
If a class has no dependencies or only depends on other concrete classes (not interfaces), the container does not need to be instructed...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ccrd yes, for all the resolver decorators, the type of the metadata and the inject property won’t match and hence the current implementation of autoinject+resolver_decorators won’t work.
@EisenbergEffect as such sure, but that was a hack. anyways, i did dig further and found that this bug was introduced when fixing that issue #121 in pr #129. however, that issue highlights, that the design of @lazy et al., didn’t took inheritance into account. i’ll see if i can find some solution
Merged the fix 😃