Importing and Exporting Modules
Understand how to import and export Angular modules to properly register components across your application. Learn why modules don't render content directly, how to register components within modules, and the role of declarations and exports. Discover how importing a module bundles its components for reuse and improves application organization and scalability.
We'll cover the following...
In the previous lesson, if you run the code, nothing changes in the application. It’s still rendering the default page.
There are two reasons for this. First, modules don’t render content. That’s the job of components. Second, Angular will not register the other modules for you. Unlike components, directives, or pipes, modules need to be registered manually.
Let’s create a component that will render the content for the homepage.
Creating components
In the command line, run the following command:
ng generate component home/home-main
The command is slightly different. We’re providing the ...