我正在使用ngrx/store
,这里需要一个标头模块来显示日历列表。在日历模块中,我有一个像这样的选择器:我正在使用延迟加载
import { State } from "./../../state/app.state";
import { EventState, ModelEvent } from "./../models/model.event";
import { createFeatureSelector, createSelector, ActionReducerMap } from "@ngrx/store";
export interface NewState extends State {
events:EventState
}
const getCalendarFeatureState = createFeatureSelector<NewState>("reducerCalendar");
export const getEvents = createSelector(getCalendarFeatureState, state => {
return state.events; //how to call it from sharedMoudle under header component?
});
我的共享模块:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { SideNavComponent } from './side-nav/side-nav.component';
import { HeaderNavComponent } from './components/header-nav/header-nav.component';
import { HeaderNavShellComponent } from './containers/header-nav-shell/header-nav-shell.component';
@NgModule({
declarations: [
HeaderComponent,
FooterComponent,
SideNavComponent,
HeaderNavComponent,
HeaderNavShellComponent
],
imports: [
CommonModule
],
exports: [
HeaderComponent,
FooterComponent,
SideNavComponent,
HeaderNavComponent, //requires "getEvents" value.
HeaderNavShellComponent
]
})
export class SharedModule { }