我有一个初始化效果的效果=>
@Effect()
init$ = this.actions$.pipe(
ofType(ROOT_EFFECTS_INIT),
map(action =>
new featureActions.GetAllMissionRequest({
projectID: environment.projectId,
projectContextID: environment.projectId
})
)
);
我在文件的底部添加了这个,我还试图包括一个defer,但当我的商店初始化时,这个效果从未被触发。
我检查了ngrx的repo,但是我应用的解决方案没有触发我的函数。
我做错什么了吗
2条答案
按热度按时间nbysray51#
对于这种情况,您可以在OnInitEffects效果上实现:
yourAction.ts
yourEffect.ts
我在https://ngrx.io/guide/effects/lifecycle#oniniteffects上看到了这个
amrnrhlw2#
为了使事件派遣你必须登记你的影响:
https://ngrx.io/guide/effects#registering-root-effects