Conditionnal import of the library #102
Replies: 2 comments 1 reply
-
I guess your issue is related to providing async values for a module configuration. This problem is still being discussed here: angular/angular#23279. One Angular developer provided as very sexy solution (angular/angular#23279 (comment)) that does not work with modules since they are loaded too early in the process. Regarding your issue, if providing the configuration as a Promise could be a solution (from what I understand), then check the branch
This branch has not been integrated into main yet, because:
If you have a look at it, let me know if it solves your problem! |
Beta Was this translation helpful? Give feedback.
-
Hello, thank you again for your answer. The promise allow us to configure conditionnally the matomo module even if I prefer this solution to do it :
Whether it's token injection or promise, I'm always obliged to import MatomoModule even if the user doesn't need it... Do you see another way without importing automatically MatomoModule ? I can do this kind of thing with module like Msal for example. Best regards, Romain |
Beta Was this translation helpful? Give feedback.
-
Hello,
I would like to import the MatomoModule only if the user setted matomo configuration (conditionnally). I tried this 2 solutions but it doesn't work :
or this :
Also, I know you can call the MatomoModule.forRoot() in the imports and inject MATOMO_CONFIGURATION later, but the module is still imported even if the user don't need matomo.
Does the library have another way of doing this?
Best regards,
Romain
Beta Was this translation helpful? Give feedback.
All reactions