Modules Flashcards
What are NgModules?
They are containers for a cohesive block of code dedicated to an application domain, workflow or closely related set of capabilities
What can NgModules contain?
components, service providers and other code files whose scope is defined by the containing NgModule
How is the AppModule defined?
import { BrowserModule } from ‘@angular/platform-browser’;
@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FormsModule, HttpClientModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
Every angular app has at least one root module. How is it named? And where does it resides
- AppModule
2. app.module.ts
What is @NgModule() and why do we need it?
@NgModule() is a decorator function. We need it to pass metadata configuration for the module
Regarding NgModule metadata.
What is the property declarations?
The components, directives, and pipes that belong to the NgModule
Regarding to NgModule metadata.
What is the exports property?
a subset of declarations that should be visible and usable by other components
Regarding NgModule metadata.
What is the imports property?
others modules whose exported classes are needed in the current module
Regarding NgModule metadata.
What is the providers property?
Creators of services
Regarding NgModule metadata.
What is the bootstrap property?
The app main view, root component. Only the root NgModule should set the bootstrap property