I need a little help with making a function return an observable. I have a function (let's call it mainFunction
), that calls an async function (let's call it getAsyncWithCallback
) and executes a callback. Part of the callback is an async call that returns an observable (let's call it getData
).
getAsyncWithCallback
is part of a library and I cannot change it.
This is what I have:
mainFunction(){
getAsyncWithCallback(() => {
let myObservable = getData();
});
}
This is what I want to do:
mainFunction().subscribe((data) => {
// data is the data from getData()
});
What is the best way to achieve this, and chain in the error and completion form the inner?
myObservable
(or assign it somewhere), I don't think there's much you can do... – acdcjuniormyObservable
in there. – Grey