Below I have an example of what I am currently facing in the app:
app.module.ts
@NgModule({
...
imports: [StoreModule.forRoot(reducers)],
...
})
export class AppModule {}
store
users: {...}
articles.module.ts
@NgModule({
...
imports: [StoreModule.forFeature('articles', reducers)],
...
})
export class ArticlesModule {}
User navigates to /articles
and then the articles
state slice will be added to the store
store
users: {...},
articles: {...}
Now, let's say initially, the store only has users
, and within a component (belonging to users module), I am using a selector
, the issue I have is that, I need to know in the selector if the articles
slice has been added to the store or not, but I cannot use any articles
selectors since I get this error
Cannot access 'selectArticles' before initialization....`
Is there a way to ask if the store contains a certain slice loaded?