2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								include ../_util-fns
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:marked
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  # Angular Modules (NgModules) have landed in Angular RC5!
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  # Angular模块( ) ! 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  _Angular Modules_, also known as _NgModules_, are the powerful new way to organize and bootstrap your Angular application. 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  *Angular模块*(也叫*NgModule*)是组织代码和引导应用的强力新途径。
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								.l-sub-section
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  :marked
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    Read more in the ["RC5 and NgModules" announcement](https://angularjs.blogspot.com).
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    要了解更多,参见["RC5和NgModule"正式发布](https://angularjs.blogspot.com)。
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Learn the details of NgModule in the [Angular Module](../guide/ngmodule.html) chapter.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								    要深入了解NgModule, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:marked
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  The new  `@NgModule` decorator gives you module-level components, directives, and pipes without 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  the need to specify them repeatedly in every component of your application. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  新的`@NgModule`装饰器让我们可以指定模块级的组件、指令和管道,而不需要在应用中的每个组件中都指定它们。
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  The `@NgModule` metadata give the Angular compiler the context needed so that you can use the same code 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-14 12:32:02 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  regardless of whether you are running Angular in [Ahead-of-time](../glossary.html#aot) or [Just
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								   in Time](../glossary.html#jit) mode.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  `@NgModule`元数据为Angular编译器提供了上下文环境, 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## How do I use them?
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 如何使用?
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  If you were previously writing an Angular application, your app should continue to work in RC5. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  We’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  For this to work, we’ 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  如果你曾经写过Angular应用, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  我们付出了很多努力来确保RC4中的应用也能正常工作在RC5中。
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  * We create an implicit `NgModule` for you as part of the `bootstrap()` command
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  * 我们在`bootstrap()`命令中会为你创建一个隐式的`NgModule`
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  * We automatically hoist your components, pipes, and directives
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  * 我们会自动升级你的组件、管道和指令
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  While your application will continue to work today, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  it’ ’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  To make it easier, you can think of the process as having 5 steps.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  虽然应用仍然能工作,但你最好还是升级下应用,以确保未来的升级和废弃的特性不会给你带来困扰。
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  要让这项工作更容易,你可以遵循如下五个步骤:
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  1. **Update to RC5** - Your application should continue to work without modification, but it’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								  1. **升级到RC5** - 你的应用不用修改也仍然能正常工作, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  2. **Create an _NgModule_** - Create the root `NgModule` that you’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  2. **创建*NgModule*** - 创建一个根`NgModule`,你要用它来引导应用程序。
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  3. **Update your bootstrap** - Bootstrap that module instead of your root component
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  3. **升级你的引导代码** - 改成引导根模块,而不再是根组件
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  4. **Update your 3rd party libraries** - Take advantage of the latest from Forms, Material, Http, and more
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  4. **升级你的第三方库** - 获得最新版表单、Material设计、Http等模块的优点
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  5. **Cleanup** - Clean up your code. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  The deprecated classes, methods and properties will be removed from Angular very soon.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  5. **清理** - 清理你的代码。那些被标记为废弃的类、方法和属性将很快从Angular中移除
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  Prefer to look at code and diffs? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  Check out the upgrade in [one commit](https://github.com/StephenFluin/ngmodule-migration/commit/9f9c6ae099346e491fc31d77bf65ed440e1f164c).
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  想看看代码级变更?
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  那就来[这个提交](https://github.com/StephenFluin/ngmodule-migration/commit/9f9c6ae099346e491fc31d77bf65ed440e1f164c)吧。
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 1. Update to RC5
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 1. 升级到RC5
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  If you use npm, you should be able to either update your `package.json` file and run `npm install`. 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  Or alternatively you can run the following command:
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  如果使用npm, 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								code-example(format='.' language='bash').
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 17:53:20 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  npm install @angular/{core,common,compiler,platform-browser,platform-browser-dynamic} --save
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:marked
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  Update your optional libraries
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  更新你的可选库
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								code-example(format='.' language='bash').
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  npm install @angular/router
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  npm install @angular/forms
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 17:53:20 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  npm install @angular2-material/{core,button,card,...}@latest
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:marked
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  Update the Angular CLI if you're using that tool
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  如果你在使用Angular CLI, 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								code-example(format='.'  language='bash').
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 18:57:29 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  npm install angular-cli @angular/tsc-wrapped --save-dev
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:marked
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 2. Create an _NgModule_
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 2. 创建*NgModule*
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  Create a new file called app.module.ts. Populate it with your root component as follows:
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  创建一个名叫`app.module.ts`的新文件,把以前的根组件换成这样:
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								code-example(format='.' language='javascript').
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  import { NgModule }       from '@angular/core';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  import { BrowserModule  } from '@angular/platform-browser';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  import { AppComponent }   from './app.component';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  @NgModule({
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      declarations: [AppComponent],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      imports:      [BrowserModule],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      bootstrap:    [AppComponent],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  })
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  export class AppModule {}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:marked
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 3. Update your bootstrap
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 3. 升级你的引导代码
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-09-14 12:32:02 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  Update your `main.ts` file to bootstrap using the "Just-in-time" (JiT) compiler.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  升级`main.ts`文件, ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								code-example(format='.' language='javascript').
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  import { AppModule }              from './app/app.module';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  platformBrowserDynamic().bootstrapModule(AppModule);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:marked
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 4. Import library modules in your _NgModule_
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 4. 在*NgModule*中导入库模块
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  Remove the Angular and 3rd party library providers from your `AppComponent` providers 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  and switch to `NgModule` imports as seen in this example.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  从你的`AppComponent`的`providers`中移除Angular和第三方库中的服务提供商, 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								code-example(format='.' language='javascript').
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  imports: [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      BrowserModule, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      // Router
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      RouterModule.forRoot(config), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      // Forms
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      FormsModule, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      // Material Design
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      MdSlideToggleModule, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      MdButtonModule, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      MdToolbarModule, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      MdCardModule, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								      MdInputModule,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:marked
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  ## 5. Cleanup
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  ## 5. 清理
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  For RC5, you can leave your components, directives and pipes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  in the `directives` and `pipes` properties of your `@Component` metadata.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  In fact, we automatically hoist (add) them to the NgModule to which they belong.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  对于RC5来说, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  实际上, 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								.alert.is-important
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								  :marked
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    This option is temporary for backward compatibility. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    It will be removed in the final release of Angular 2.0.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    这个选项只是为了向后兼容而临时设置的。
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    当Angular 2.0正式发布的时候,它将会被移除。
							 
						 
					
						
							
								
									
										
										
										
											2016-08-08 17:30:05 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 15:56:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    Get ahead of the game and start moving your component `directives` and `pipes` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    into module `declarations` as soon as possible.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    We intend to delete _all_ deprecated class, methods, and properties in the next RC.
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 10:20:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    你可以先继续,但要尽早把这些组件、指令和管道移到模块的`declarations`中。
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 09:41:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    我们准备在下一个RC中删除*所有*废弃的类、方法和属性。