| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | import 'package:angular2/core.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-03 22:50:42 -08:00
										 |  |  | @Injectable() | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | class Engine { | 
					
						
							| 
									
										
										
										
											2016-06-03 11:16:46 -07:00
										 |  |  |   final int cylinders; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Engine() : cylinders = 4; | 
					
						
							|  |  |  |   Engine.withCylinders(this.cylinders); | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-03 22:50:42 -08:00
										 |  |  | @Injectable() | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | class Tires { | 
					
						
							|  |  |  |   String make = 'Flintstone'; | 
					
						
							|  |  |  |   String model = 'Square'; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @Injectable() | 
					
						
							|  |  |  | class Car { | 
					
						
							|  |  |  |   //#docregion car-ctor
 | 
					
						
							| 
									
										
										
										
											2016-03-03 22:50:42 -08:00
										 |  |  |   final Engine engine; | 
					
						
							|  |  |  |   final Tires tires; | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  |   String description = 'DI'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Car(this.engine, this.tires); | 
					
						
							|  |  |  |   // #enddocregion car-ctor
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Method using the engine and tires
 | 
					
						
							| 
									
										
										
										
											2016-06-03 11:16:46 -07:00
										 |  |  |   String drive() => '$description car with ' | 
					
						
							|  |  |  |       '${engine.cylinders} cylinders and ' | 
					
						
							|  |  |  |       '${tires.make} tires.'; | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | } |