I went into few videos explaining NgModules and the official Angular documentation about NgModules but I'm still having a grasp about how it works.
I understand that components goes into declarations
, modules into imports
and services into providers
(I also heard that since Angular v6, services don't need to be declare at all?).
What I don't understand is when and why to create "sub NgModules" like auth.module.ts
.
- Why should I create those sub NgModules?
- What is the benefit vs using only
app.modules.ts
? - Should I import those sub NgModules into
app.modules.ts
? - Is there any other things I need to know about NgModules?
Thanks