// #docregion import { Component, Injector } from '@angular/core'; import { Car, Engine, Tires } from './car'; import { Car as CarNoDi } from './car-no-di'; import { CarFactory } from './car-factory'; import { testCar, simpleCar, superCar } from './car-creations'; import { useInjector } from './car-injector'; @Component({ selector: 'my-car', template: `

Cars

{{car.drive()}}
{{noDiCar.drive()}}
{{injectorCar.drive()}}
{{factoryCar.drive()}}
{{simpleCar.drive()}}
{{superCar.drive()}}
{{testCar.drive()}}
`, providers: [Car, Engine, Tires] }) export class CarComponent { constructor(public car: Car) {} factoryCar = (new CarFactory).createCar(); injectorCar = useInjector(); noDiCar = new CarNoDi; simpleCar = simpleCar(); superCar = superCar(); testCar = testCar(); }