Is RxJS functional in Angular2/Ionic2 right now? Have an example?

I’d like to use RxJS in an Ionic 2 app

import {Rx} from "@reactivex/rxjs";

export clas Foo {
   constructor() {
      this.myUser = new Rx.BehaviorSubject(null);
   }
}

However I’m getting:

ERROR in ./~/@reactivex/rxjs/index.js
Module not found: Error: Cannot resolve ‘file’ or ‘directory’ ./dist/cjs/Rx.KitchenSink in ~/dev/myproject/node_modules/@reactivex/rxjs

I also tried

   import * as Rx from "rx";

Which fails in a similar way. Anybody have this working?

Nobody using RxJs in an Ionic app?

Taking a look at the Ionic 2 ionic-framework node_modules and the directories below it:
Have you tried

import * as Rx from "@reactivex/rxjs/dist/cjs/Rx";

Although they seem to be using Rx.KitchenSink in Ionic 2…
But @reactivex/rxjs/dist/cjs/Rx should work?

Thanks - with later updates rxjs is explicitly included in package.json in the examples.

As of Ionic2 & Angular2 Beta the right path is:

import * as Rx from 'rxjs/Rx';

Note that as of latest version of Angular2/Ionic2 uses RxJS v5.0.0-beta, so be sure to read the migration readme as some of methods names has been changed.

If anyone interested in working example of Ionic2 Beta RxJS implementation, I made a chat example app available here.

2 Likes

Thanks for sharing! Kudos!