| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | // #docregion token
 | 
					
						
							|  |  |  | import 'package:angular2/core.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-03 11:16:46 -07:00
										 |  |  | const APP_CONFIG = const OpaqueToken('app.config'); | 
					
						
							|  |  |  | // #enddocregion token
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #docregion config
 | 
					
						
							|  |  |  | const Map heroDiConfig = const <String,String>{ | 
					
						
							|  |  |  |   'apiEndpoint' : 'api.heroes.com', | 
					
						
							|  |  |  |   'title' : 'Dependency Injection' | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | // #enddocregion config
 | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-03 11:16:46 -07:00
										 |  |  | // #docregion config-alt
 | 
					
						
							|  |  |  | class AppConfig { | 
					
						
							|  |  |  |   String apiEndpoint; | 
					
						
							|  |  |  |   String title; | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-03 11:16:46 -07:00
										 |  |  | AppConfig heroDiConfigFactory() => new AppConfig() | 
					
						
							|  |  |  |   ..apiEndpoint = 'api.heroes.com' | 
					
						
							|  |  |  |   ..title = 'Dependency Injection'; | 
					
						
							|  |  |  | // #enddocregion config-alt
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const appConfigProvider = const Provider(APP_CONFIG, | 
					
						
							|  |  |  |   useFactory: heroDiConfigFactory, | 
					
						
							|  |  |  |   deps: const []); |