http:Http;
constructor(http:Http){
this.http = http;
}
myFunction(){
//this.http works great here!
this.providerobject.getSomething( function(err, result) {
//this.http here is undefined! I need to use it here
.
.
.
With the code shown above I am trying to make an http request inside of the provider.getSomething
function, but it seems the this.http
object is undefined here! How can I make an http call inside of this function? I know it has somehting to do with scope as this object works outside of the provider.getSomething
function. I do not know how to pass it in though. Say I do this:
this.providerobject.getSomething(this.http, function(err, result) {
Well that would pass it into my provider function, but not this function. How can I use this object in that scope?