Module not found: Error: Can't resolve 'rxjs/BehaviorSubject'

517 views
Skip to first unread message

Babatoonday Mattieu

unread,
Jul 16, 2018, 9:21:02 AM7/16/18
to Angular and AngularJS discussion
I was following an Angular Material tutorial and the author uses BehaviorSubject. I did exactly the same thing but I get an error at the line
`
  constructor(private http: HttpClient) {
      this.dataStore = {users : []};
      this._users =  new BehaviorSubject<User[]>([]);
}`

when I initialize BehaviorSubject in the constructor. It complies whenever i comment it.

I have checked for my error on stack overflow but it doesnt seem to be helpful
I used flexbox-layout 6.0
Angular6

Any suggestions please?

Sander Elias

unread,
Jul 17, 2018, 3:43:37 AM7/17/18
to Angular and AngularJS discussion
Did you import the BehaviourSubject from rxjs?

Babatoonday Mattieu

unread,
Jul 17, 2018, 7:20:07 AM7/17/18
to ang...@googlegroups.com
i fixed it. i was supposed to import 'rxjs' and not 'rxjs/behaviorSubject'

On Tue, Jul 17, 2018 at 8:43 AM Sander Elias <sande...@gmail.com> wrote:
Did you import the BehaviourSubject from rxjs?

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages