At the core of Angular is a sophisticated compiler, which takes a NgModule type and produces a NgModuleFactory.
A NgModule has components declared in it. While creating the module factory, the compiler will take the template of every component in the module, and using the information about declared components and pipes, will produce a component factory. The component factory is a JavaScript class the framework can use to stamp out components.