During the time of RC4, I was able to create my own custom http instance using a function like this:
export function createHTTP(url:string, headers?:Headers){
let injector = ReflectiveInjector.resolveAndCreate([
myHttp,
{provide:'defaultUrl', useValue:url},
{provide:'defaultHeaders', useValue:headers || new Headers()},
// Here is where HTTP_PROVIDERS used to be included
])
return injector.get(myHttp)
}
The 'myHttp' class served as a wrapper for Http.
@Injectable()
export class myHttp{
constructor(@Inject('defaultUrl) private url:string, @Inject('defaultHeaders') private headers:Headers, private http:Http){}
get()
put()...
}
With HTTP_PROVIDERS now deprecated and removed, how can I achieve the same functionality?
Thanks!