I have a class. I need to do some http work inside of a timeout. The problem I am faceing is the http variable inside the timeout keeps saying it is undefined.
export class MyClass {
http:Http:
constructor(private http:Http) {
this.http = http;
}
sendFriendRequest(){
this.http.post( ...//http variable is defined here
setTimeout(function(){
this.http.post(... //http is not defined here
}
}
}