最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - RxJS: How to import Just - Stack Overflow

programmeradmin0浏览0评论

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))
发布评论

评论列表(0)

  1. 暂无评论