rxjses6-promisefetch-api

How to convert a Fetch API response to RxJS Observable?


How can I convert whatever Fetch API returns to RxJS Observable? Does RxJS.fromPromise help?


Solution

  • check out this article

    var result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));
    result.subscribe(x => console.log(x), e => console.error(e));