admin管理员组

文章数量:1391811

I'd like to use RxJS's just.
What I need it for is Observable.just(null), which can't be done with Observable.from().

I'm trying

import 'rxjs/add/operator/just';

But it's not present in where it should be - node_modules/rxjs/add/operator, so this fails to pile.

How can I add this operator?

I'd like to use RxJS's just.
What I need it for is Observable.just(null), which can't be done with Observable.from().

I'm trying

import 'rxjs/add/operator/just';

But it's not present in where it should be - node_modules/rxjs/add/operator, so this fails to pile.

How can I add this operator?

Share Improve this question asked Dec 13, 2016 at 3:00 Ondra ŽižkaOndra Žižka 47k49 gold badges227 silver badges298 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11

That depends on the version of Rx.js:

  • 4.0 includes a .just method;
  • 5.0 doesn't. Instead, use the .of method.

Like this:

Rx.Observable.of(null).forEach(x => console.log(x))

本文标签: javascriptRxJS How to import JustStack Overflow