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