-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(element): add support for dynamic module configuration #29
feat(element): add support for dynamic module configuration #29
Conversation
- support dynamic config in LazyElementsModule.forRoot - support dynamic config in LazyElementsModule.forFeature
Codecov Report
@@ Coverage Diff @@
## master #29 +/- ##
==========================================
+ Coverage 85.86% 86.05% +0.19%
==========================================
Files 30 30
Lines 290 294 +4
Branches 38 40 +2
==========================================
+ Hits 249 253 +4
Misses 34 34
Partials 7 7
Continue to review full report at Codecov.
|
Hi @MagicCurlyHair ! Sorry for the late response, I think the idea to support that is great! The implementation looks a bit like too much, but I am not sure if it can be reduced to a bit less will explore it and let you know. |
Hey @tomastrajan I agree that it's far from being minimalistic. I spent quite some time on this issue and this is the only solution that I have come up with that doesn't break anything and seems to be working under all conditions. Maybe there is a better way, but I haven't found any. |
I like this idea, any news on this? :) |
@pschalk @MagicCurlyHair will try to have a look soon |
@MagicCurlyHair @pschalk I had a look and I think we do not need this solution after conversation with @irekBudzowski as it can be achieved already today without complicating the library further... The solution is to provide already available @NgModule({
imports: [LazyElementsModule.forFeature({})],
providers: [
{
provide: LAZY_ELEMENT_CONFIGS,
useFactory: elementConfigsFactory,
multi: true
}
]
})
export class SomeFeatureModule {}
export function elementConfigsFactory() {
// resolve config dynamically
} The solution then would be to update the docs so it is clear how this can be achieved... |
@tomastrajan great idea, I like it. This PR can be closed then |
So I have added docs which describe how this can be done. Also, there was a little change to how the |
This pull request makes it possible to configure LazyElementsModule with dynamic values known only at runtime, while still allowing for AOT compilation. Implements functionality for #28. The API now supports two signatures:
Please review and let me know what you think. I'll work on adding documentation later.