How to correctly import operators from the `rxjs` package

Viewed 8193

I am confused how to import those operators. Some I can import with import 'rxjs/add/operator/do'; and some I can not. For ex, this does not work: import 'rxjs/add/operator/map'; (I checked in rxjs/add/operator, map exists there).

Essentially what I am trying to do is to reproduce this in Angular4:

var requestStream = Rx.Observable.just('https://api.github.com/users');

var responseStream = requestStream
  .flatMap(function(requestUrl) {
    return Rx.Observable.fromPromise(jQuery.getJSON(requestUrl));
  });

responseStream.subscribe(function(response) {
  // render `response` to the DOM however you wish
});

I also want to know how to deal with just operator, since I can not see it in rxjs/add/operator...

Thanks for any help

2 Answers
Related