angular - Where do I share my observables in ngrx? -
to honest, i'm not sure issue, i'm curious sharing observables when using ngrx. let's have these 3 variables in store control whether open or expanded:
export interface state { issidebaractive: boolean; isplaylistexpanded: boolean; isfolderlistexpanded: boolean; }
if return 3 variables single selector, might end same variable being used multiple times in template. isn't actual code, bear me:
<div [hidden]="!(uistate$ | async)?.issidebaractive"> <ul [@expand]="(uistate$ | async)?.isplaylistexpanded"> <li></li> </ul> <ul [@expand]="(uistate$ | async)?.isfolderlistexpanded"> <li></li> </ul> </div>
from understand, create 3 unique subscriptions uistate$, , can use .share() operator share 1 subscription 3 items. if necessary, share observable? here?
constructor(private store: store<fromroot.state>) { this.uistate$ = this.store.select(fromroot.getuistate).share(); }
looking @ this answer, i'm not sure necessary.
tia.
Comments
Post a Comment