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
1 Answer
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条)