@NgModule
NgModule
configures the injector and the compiler and help organize related things together.
Example
The CLI generates the following basic app module when creating a new app.
@NgModule({
declarations: [
AppComponent,
ItemDirective
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Options
bootstrap
#
bootstrap?: Array<Type<any>|any[]>
declarations
#
declarations?: Array<Type<any>|any[]>
entryComponents
#
entryComponents?: Array<Type<any>|any[]>
exports
#
exports?: Array<Type<any>|any[]>
id
#
id?: string
imports
#
imports?: Array<Type<any>|ModuleWithProviders<{}>|any[]>
jit
#
jit?: true
providers
#
providers?: Provider[]
schemas
#
schemas?: Array<SchemaMetadata|any[]>