I updated my angular project and all my dependencies to latest version. Without to much trouble I solved most of the dependency issues, but I\'m still stuck on RxJS. Here is
You can fix it with this:
import {from} from 'rxjs';
And, instead of: return Observable.fromPromise(new Promise((resolve, reject) => {
Now just do:
return from(new Promise((resolve, reject) => {
The same applies to Observable.of
There is a lot of breaking changes with RxJS 6. For example, prototype methods as
myObservable.map(data => data * 2)
won't work anymore and must be replaced by
myObservable.pipe(map(data => data * 2))
All details can be found here: https://github.com/ReactiveX/rxjs/blob/master/docs_app/content/guide/v6/migration.md
Until you have fixed all breaking changes, you can make your old code work again with rxjs-compat
(https://github.com/ReactiveX/rxjs/tree/master/compat).
This package is required to get backwards compatibility with RxJS previous to version 6. It contains the imports to add operators to
Observable.prototype
and creation methods toObservable
.
Type this to install it:
npm install -s rxjs-compat
I hope your problem will resolve using this below statement
import Subscription from 'rxjs'
afaik Angular 6 and rxjs 6 are not already compatible, for the compatibility they created https://www.npmjs.com/package/rxjs-compat you have to install
[UPDATE] fromPromise is now "from". see here : https://github.com/ReactiveX/rxjs/issues/3525