I'm having a problem using RxJS with Angular 2. Most of methods suggested from Typescript definition file are not defined on my Observable object like...
then I figured out, that methods does not exists on the Observable prototype.
I know a lot of things changed from version 4 to 5,so do I miss something?
I have a JSPM setup in my project, so adding rxjs to the path section was not enough.
jspm added the following to my SystemJS configuration (map section):
So if you use jspm make sure you remove the rxjs mapping above, otherwise some rxjs files will be loaded twice, once via jspm_packages and once via node_modules.
Yes, in Angular 2.0 you have to include the operators/observables you need.
I do it like this:
However, you also need to configure this in System.js
Here is working code: https://github.com/thelgevold/angular-2-samples
Without seeing your actual code, I can't tell you exactly what to add to fix it.
But the general problem is this: RxJS 5 is not included with Angular 2 any longer now that it has entered the Beta stage. You will need to import either the operator(s) you want, or import them all. The import statements looks like this:
or like
To determine the path to your desired module, look at the source tree. Every import with
add
will add properties toObservable
orObservable.prototype
. Withoutadd
, you'd need to doimport {foo} from 'rxjs/path/to/foo'
.You will also need to make sure that RxJS is being brought into the project correctly. Something like this would go into your index.html file:
If you use Webpack to build the Angular 2 app like in this Github project (like I did), then you don't need that
System
stuff and the imports should do it.