I have typescript project and more specific and Angular application.
I have my Class called Test (you can assume its a component in angular) and it has access to http service which is usually used like this.http('/endpoint').subscribe(response => {});
I need to add some logic in between and break it down into separate methods (the code is a little bit more complicated than in my example).
export class Test {
init() {
this.http.get('/endpoint').map(this.transform);
}
transform(data) {
// more logic here in isolated scope
this.accessOutside(data); // I cannot access this method, isolated scope.
// How to break down some logic into separate methods to access them
// or how to create it new method within method?
return data
}
accessOutside(data) {
// more logic
}
}
When i call this.http.get('/endpoint').map(this.transform) my "transform" method is isolated and has no access to other methods within Test class, but how to access it or how to create method within transform method?