| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | // #docregion
 | 
					
						
							|  |  |  | import 'package:angular2/core.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-03 22:50:42 -08:00
										 |  |  | @Injectable() | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | // #docregion engine
 | 
					
						
							|  |  |  | class Engine { | 
					
						
							| 
									
										
										
										
											2016-03-03 22:50:42 -08:00
										 |  |  |   final int cylinders = 4; | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | } | 
					
						
							|  |  |  | // #enddocregion engine
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-03 22:50:42 -08:00
										 |  |  | @Injectable() | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | // #docregion tires
 | 
					
						
							|  |  |  | class Tires { | 
					
						
							|  |  |  |   String make = 'Flintstone'; | 
					
						
							|  |  |  |   String model = 'Square'; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #enddocregion tires
 | 
					
						
							|  |  |  | @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-03-03 22:50:42 -08:00
										 |  |  |   String drive() => '$description car with ${engine.cylinders} cylinders' | 
					
						
							|  |  |  |       ' and ${tires.make} tires.'; | 
					
						
							| 
									
										
										
										
											2016-02-06 17:02:44 -05:00
										 |  |  | } | 
					
						
							|  |  |  | // #enddocregion car
 |