2016-08-08 20:18:50 -04:00
|
|
|
|
@cheatsheetSection
|
|
|
|
|
NgModules
|
|
|
|
|
@cheatsheetIndex 1
|
|
|
|
|
@description
|
2016-08-25 14:12:23 -04:00
|
|
|
|
{@target ts}`import { NgModule } from '@angular/core';`{@endtarget}
|
|
|
|
|
{@target js}Available from the `ng.core` namespace{@endtarget}
|
2016-08-08 20:18:50 -04:00
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2016-08-25 14:12:23 -04:00
|
|
|
|
syntax(ts):
|
2016-09-01 15:06:42 -04:00
|
|
|
|
`@NgModule({ declarations: ..., imports: ...,
|
|
|
|
|
exports: ..., providers: ..., bootstrap: ...})
|
2016-08-08 20:18:50 -04:00
|
|
|
|
class MyModule {}`|`NgModule`
|
|
|
|
|
description:
|
2016-09-01 15:06:42 -04:00
|
|
|
|
Defines a module that contains components, directives, pipes, and providers.
|
2016-08-08 20:18:50 -04:00
|
|
|
|
|
2016-08-25 14:12:23 -04:00
|
|
|
|
syntax(js):
|
2016-09-01 15:06:42 -04:00
|
|
|
|
`ng.core.NgModule({declarations: ..., imports: ...,
|
|
|
|
|
exports: ..., providers: ..., bootstrap: ...}).
|
2016-09-07 19:05:05 -04:00
|
|
|
|
Class({ constructor: function() {}})`
|
2016-08-25 14:12:23 -04:00
|
|
|
|
description:
|
2016-09-01 15:06:42 -04:00
|
|
|
|
Defines a module that contains components, directives, pipes, and providers.
|
2016-08-08 20:18:50 -04:00
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2016-09-01 15:06:42 -04:00
|
|
|
|
syntax:
|
2016-08-08 20:18:50 -04:00
|
|
|
|
`declarations: [MyRedComponent, MyBlueComponent, MyDatePipe]`|`declarations:`
|
|
|
|
|
description:
|
2016-09-01 15:06:42 -04:00
|
|
|
|
List of components, directives, and pipes that belong to this module.
|
2016-08-08 20:18:50 -04:00
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2016-08-25 14:12:23 -04:00
|
|
|
|
syntax(ts):
|
2016-08-08 20:18:50 -04:00
|
|
|
|
`imports: [BrowserModule, SomeOtherModule]`|`imports:`
|
|
|
|
|
description:
|
2016-09-01 15:06:42 -04:00
|
|
|
|
List of modules to import into this module. Everything from the imported modules
|
|
|
|
|
is available to `declarations` of this module.
|
2016-08-08 20:18:50 -04:00
|
|
|
|
|
2016-08-25 14:12:23 -04:00
|
|
|
|
syntax(js):
|
|
|
|
|
`imports: [ng.platformBrowser.BrowserModule, SomeOtherModule]`|`imports:`
|
|
|
|
|
description:
|
2016-09-01 15:06:42 -04:00
|
|
|
|
List of modules to import into this module. Everything from the imported modules
|
|
|
|
|
is available to `declarations` of this module.
|
2016-08-25 14:12:23 -04:00
|
|
|
|
|
2016-08-08 20:18:50 -04:00
|
|
|
|
@cheatsheetItem
|
2016-09-01 15:06:42 -04:00
|
|
|
|
syntax:
|
2016-08-08 20:18:50 -04:00
|
|
|
|
`exports: [MyRedComponent, MyDatePipe]`|`exports:`
|
|
|
|
|
description:
|
2016-09-01 15:06:42 -04:00
|
|
|
|
List of components, directives, and pipes visible to modules that import this module.
|
2016-08-08 20:18:50 -04:00
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2016-09-01 15:06:42 -04:00
|
|
|
|
syntax:
|
2016-08-08 20:18:50 -04:00
|
|
|
|
`providers: [MyService, { provide: ... }]`|`providers:`
|
|
|
|
|
description:
|
2016-09-01 15:06:42 -04:00
|
|
|
|
List of dependency injection providers visible both to the contents of this module and to importers of this module.
|
2016-08-08 20:18:50 -04:00
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2016-09-01 15:06:42 -04:00
|
|
|
|
syntax:
|
2016-08-08 20:18:50 -04:00
|
|
|
|
`bootstrap: [MyAppComponent]`|`bootstrap:`
|
|
|
|
|
description:
|
2016-09-01 15:06:42 -04:00
|
|
|
|
List of components to bootstrap when this module is bootstrapped.
|