|
Answer» NgModule is a special decorator that marks a TS class as an Angular Module. You can think of an Angular module as a logical chunk of code that is delegated a responsibility. An NgModule class describes how the application parts fit together. Every application has at least one NgModule, the root module that we bootstrap to LAUNCH the application. @NgModule accepts a metadata object that tells Angular how to compile and launch the application. The properties are: - imports – External or internal modules that the application needs or depends on to run, like the BrowserModule that every application needs to run in a browser.
- declarations – the application's components, which belongs to the NgModule class. We must declare every component in an NgModule class. If we use a component WITHOUT declaring it, we'll see a clear error message in the browser’s console.
- bootstrap – the root component that Angular creates and inserts into the index.html host web PAGE. The application will be launched by creating the components listed in this ARRAY.
- exports - exports is an array of components that are made available to other modules from within this module. In a way, exported classes are made available to the outside world.
- providers - is also an array and contains the LIST of all the services and injectables.
|