我正在尝试通过ngrx效果打开星云对话框。它有效,但不是第一次。
第一次出现错误:
“错误TypeError:无法读取null的属性'appendChild'”
如果刷新页面和打开的对话框打开,则
action.ts:
export const loadModal = createAction('[Products] Load Replenish Invoice Modal', props<{ payload: string }>());
effect.ts
loadModal$ = createEffect(
() =>
this.actions$.pipe(
ofType(ProductsActions.loadModal),
tap(action => {
console.log(action);
this.dialogService.open(ProductConfirmModalComponent, {});
}),
),
{ dispatch: false },
);
这是我要分派动作的组件:
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
this.store.dispatch(loadCurrencies({ payload: params.type }));
});
}