How import works in angular and how to optimize from sharedModule?

In General, I don't understand how import works, I have two suggestions:
1) the Logic of the class is copied to where it is imported,
ie 10 modules I import one component at a time(same) this component will be copied 10 times

2) When you first import in the total bundle gets the component(and the like) and then where there is import, just open access

And as SharedModule can optimize the app?
April 4th 20 at 00:43
1 answer
April 4th 20 at 00:45
Solution
Import модуля1 in module 2 initialisere injector модуля1 and it is available for injector модуля2.
It creates instances of providers модуля1, and the declared entities of module 1 and new instances of providers модуля1 become visible to модуля2.
Components cannot be imported.

Location Bedlam determines webpac, if not, lazy modules then everything will be in main. If Leisi, the total imports is also likely to fall into the main.
Your option 2 is closer to reality.
SharedModule not needed. He is the type of aggregator for the shared modules, so less lines in the imports.
Thank you!) - emanuel commented on April 4th 20 at 00:48

Find more questions by tags Angular