Components are for building small reusable features in your product. They work together with concepts such as services, directives, pipes, and so on, to make a functional feature. In some situations, you may want these features to be moved around from one project to another or even between different sections of a huge project. Therefore, you need a way to collect them together as a feature. This is exactly what modules do.

Modules are classes decorated with the NgModule decorator. The decorator takes an object, just like the component decorator. This object describes all the feature members that you need to associate to this module. The possible members (but not all members) are as follows:

  • Declarations: These include components, ...

Get TypeScript 2.x for Angular Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.