'Angular: Using non-exported components of a module (modal)
I am currently refactoring my application into much smaller modules. It seems to be a common practice, since almost all "large" ui-libraries do that (NgBootstrap and NgPrime at least).
For that, I have read the angular documentation and some guidelines.
I am now putting each widget in it's own module (together with its directives, if any). Other, larger components that rely on those "base widgets" then import those, but do not export them again.
Now I have started with exporting my components that are meant to be used as modals (via NgbModal). I accidentally forgot to export my main component, but to my surprise... everything worked?
I do not even need to declare the component, it still works.
Here is a very basic demo (stackblitz).
Is this purely because the "code" gets loaded by importing the modal component in the .ts file? Apparently declarations and exports in modules are only relevant for the template parsing, in order to match the correct tags to the correct component. What are the implications of this? Should I not export components that are instantiated via code? I was unable to find a guideline about this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
