javascript - Angular Module has no exported member 'fromEvent' - Stack Overflow

I was trying to follow along with the official Angular tutorial on practical observable usage and attem

I was trying to follow along with the official Angular tutorial on practical observable usage and attempted to import the "fromEvent":

import { fromEvent } from 'rxjs';

However, it keeps throwing an error message which states "myApp/node_modules/rxjs/Rx" has no exported member 'fromEvent'

I've already searched SO and Googled, with no luck.

I was trying to follow along with the official Angular tutorial on practical observable usage and attempted to import the "fromEvent":

import { fromEvent } from 'rxjs';

However, it keeps throwing an error message which states "myApp/node_modules/rxjs/Rx" has no exported member 'fromEvent'

I've already searched SO and Googled, with no luck.

Share Improve this question asked May 9, 2018 at 16:54 Justin FJustin F 2515 silver badges13 bronze badges 3
  • 1 First Google search shows this, where it's imported from a subfolder, does that work? What version of rxjs? – Phix Commented May 9, 2018 at 16:57
  • 1 Wow, that was fast! My Google-foo is not up to snuff: What was your search string? And yes, that helps tremendously! – Justin F Commented May 9, 2018 at 17:00
  • 1 fromEvent rxjs, glad it helped! – Phix Commented May 9, 2018 at 18:48
Add a ment  | 

1 Answer 1

Reset to default 9

'fromEvent' appears to be part of Observable. You can import it like this:

import { fromEvent } from 'rxjs/observable/fromEvent';

Unlike answers elsewhere, importing "Observable" did not help, and I had to rely on VS code correctly auto suggesting where to import from (After spending quite a bit of time trying to figure out why the import did not work).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745366304a4624596.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信