NgModules

Let's learn about Ng modules in this chapter.

Chapter learning outcomes

So far, we’ve discussed the architecture of an Angular project. We’ve created the basic version of our demo application, the Client Contacts Manager, and added some components to this application. Everything we’ve done so far has all been developed within the single module that Angular generates for us.

In this chapter, we will start looking further into modules in Angular. We had already seen new modules being used when we added Angular Material and Forms to our example application, but now we are going to look into how modules are structured, what each part of the module file does, and how to create them using the Angular CLI.

We will then look at why modules are used and how they help divide up the application’s functionality, especially for large enterprise applications. We will then continue expanding on our example application by adding new modules for the various sections of our application. This chapter will help you to develop your own Angular application modules. And it will show you how you can use modules to structure your application.

By the end of this chapter, you will learn the following:

  • How modules are structured
  • How to add your components to a module
  • How to create modules using the CLI
  • How to separate the functionality of an application using modules
  • How to plan the structure of applications using modules

Client contacts manager application

📝 Note: Here is the preview of what we will create in this chapter. Press the RUN button to compile and serve the application. Once the app compiles, you can see its output in the Output tab or by clicking on the URL given after Your app can be found at.

Get hands-on with 1200+ tech skills courses.