I have a code like this:
myMethod(data: any, layerId: string, dataSubstrings): void {
someObject.on('click', function(e) {
this.api.getSomething(a).subscribe((result: any) => { // WRONG CALL 1. It is from another component
// code
this.outSideMethod(a)); // WRONG CALL 2
}
}, (error: any) => {
return {};
})
});
outSideMethod(a): any[] {
//etc
}
I need to call this.api.getSomething(a));
(and also outSideMethod()) but I get `Cannot read property 'getSomething' of undefined.
I don't know my problem using this (POO), could someone give me some hints please.