Hongbo Miao
Hongbo Miao

Reputation: 49804

Cannot find module 'rxjs/subject/BehaviorSubject'

I am using Angular 2.

When I use either of these two, my program runs well:

import { BehaviorSubject } from 'rxjs/Rx';
import { BehaviorSubject } from 'rxjs';

However, I try to use the following way:

import { BehaviorSubject } from 'rxjs/subject/BehaviorSubject';

But I failed, my browser console shows:

Uncaught Error: Cannot find module 'rxjs/subject/BehaviorSubject'

How can I use third way correctly? Thanks

Upvotes: 32

Views: 36140

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657376

import {BehaviorSubject} from 'rxjs/BehaviorSubject';

rxjs 6.x

import {BehaviorSubject} from 'rxjs';

See also

Upvotes: 83

Related Questions