I have a class called data.ts. In that i have a method which is called from various components. This method subscribes the data from another service. On the completion of subscribe event i want to process the data received from server and call the callback method of component who has invoked myFunction. Is that possible to do? something like below:
myFunction(callback: function) {
otherService.getData().subscribe((res: Response) => {
//do some processing of response
caller.callback(processed_response)
});
}