Reputation: 5698
My problem is simple. I have 2 observables:
assetNodes$: Observable<Asset[]>;
isLoading$: Observable<boolean>;
I am selecting Observables for these 2 using the following code:
this.assetNodes$ = this.store.pipe(select((state: AppState) => state.dashboard.assetTree));
this.isLoading$ = this.store.pipe(select((state: AppState) =>
{
console.log(state)
state.dashboard.assetTreeLoading
}));
The variable assetNodes$
works fine, but the second Observable this.isLoading$
is never called (and hence no console.log). I believe this is due to the fact you can only select from the store once? What am I doing wrong here?
Upvotes: 0
Views: 1673
Reputation: 15505
You can select more than once from the store. I think it's because you aren't returning something in the second selector:
this.isLoading$ = this.store.pipe(select((state: AppState) =>
{
console.log(state);
return state.dashboard.assetTreeLoading;
}));
Upvotes: 1