Rx.Observable.prototype.skip undefined

I have an Angular 2 application with the following code:

  nextPage() {
    this.currentPage += 1;
    this.files = this._rawFiles
      .skip((this.currentPage - 1) * 100)
      .take(100);
  }

It returns the following error:

ORIGINAL EXCEPTION: TypeError: this._rawFiles.skip is not a function

this._rawFilescreated by the Angular service Http, so it is supposed to use RxJS. Here's what it looks like when printing to the console:

screenshot

This seems to be observable, but there are only a few methods. Why not Rx.Observable.prototype.skip(count)there?

Here's what the relevant part looks like package.json:

  "dependencies": {
    "@angular2-material/button": "^2.0.0-alpha.1",
    "@angular2-material/card": "^2.0.0-alpha.1",
    "@angular2-material/checkbox": "^2.0.0-alpha.1",
    "@angular2-material/core": "^2.0.0-alpha.1",
    "@angular2-material/progress-circle": "^2.0.0-alpha.1",
    "@angular2-material/radio": "^2.0.0-alpha.1",
    "@angular2-material/sidenav": "^2.0.0-alpha.1",
    "@angular2-material/toolbar": "^2.0.0-alpha.1",
    "angular2": "2.0.0-beta.12",
    "core-js": "^2.1.5",
    "rxjs": "5.0.0-beta.2",
    "zone.js": "0.6.6"
  },

This is just plain RxJS, not some kind of light version. Should it include all methods?

+4
source share
2 answers

If you want to include all methods, use:

import 'rxjs/Rx';

skip(), :

import 'rxjs/add/operator/skip';

Rx , .

+3

import 'rxjs/add/operator/skip';

,

import 'rxjs/Rx';

.

+1

All Articles