import 'reflect-metadata' ; import { ReflectiveInjector , Inject , Injectable } from '@angular/core' ; class Http { } class DummyService { } @ Injectable ( ) class UserService { constructor ( public http ) { } } let dummyHttp = { get ( ) { } , post ( ) { } } ; let injector = ReflectiveInjector . resolveAndCreate ( [ { provide : DummyService , useValue : dummyHttp } , { provide : Http , useExisting : DummyService } , UserService ] ) ; console . assert ( injector . get ( UserService ) . http === dummyHttp ) ;