Nexus23
Nexus23

Reputation: 6373

Cannot find rxjs select operator used by ngrx store.select

Cannot find select operator from rxjs library.

As I understand and explained here, ngrx store uses select operator from rxjs library when we call store.select method. The way it is currently working is if I imort the whole rxjs library:

import 'rxjs/Rx';

But this imports the whole rxjs operators, I only want to import the operators I need.

If I exclude rxjs/Rx import, get this error:

TypeError: this.store.select(...).first is not a function

I have also done a global search in npm rxjs package directory and that folder doesn't have any file with select in it. Really confusing.

Upvotes: 2

Views: 1372

Answers (2)

Gopala Raja Naika
Gopala Raja Naika

Reputation: 2679

Please try as well

npm un --save rxjs
npm un --save rxjs-compat

npm i --save [email protected]
npm i --save [email protected]

Upvotes: 0

martin
martin

Reputation: 96969

If you don't want to import the entire library you can pick only the operators/Observables you want with for example:

import 'rxjs/add/operator/first';

You can see the full list here: https://github.com/ReactiveX/rxjs/tree/master/src/add/operator

Upvotes: 2

Related Questions