如何将 ofType 用于 5 个以上的动作?
How to use ofType with more than 5 actions?
我必须在效果中使用 ofType 超过 5 个动作。
@Effect()
applyInspectionsFilters$: Observable<Action> = this.actions$.pipe(
ofType(
InspectionsPageActions.applyInspectionsFilters.type,
InspectionsPageActions.clearSelectedInspectionsFilters.type,
InspectionsPageActions.removeSelectedStatusFilter.type,
InspectionsPageActions.removeSelectedAttributeFilter.type,
InspectionsPageActions.removeSelectedUserFilter.type,
InspectionsPageActions.removeNotAssignedUsersFilter.type
),
withLatestFrom(
this.store$.pipe(select(fromInspections.getSelectedInspectionsFilters))
),
switchMap(([action, filters]) =>
...
)
);
当他们库中参数的最大数量为5时,我应该怎么做?
文档在这里:https://ngrx.io/api/effects/ofType
显示方法是这样的:
ofType(
...[InspectionsPageActions.applyInspectionsFilters.type,
InspectionsPageActions.clearSelectedInspectionsFilters.type,
InspectionsPageActions.removeSelectedStatusFilter.type,
InspectionsPageActions.removeSelectedAttributeFilter.type,
InspectionsPageActions.removeSelectedUserFilter.type,
InspectionsPageActions.removeNotAssignedUsersFilter.type]
),
我必须在效果中使用 ofType 超过 5 个动作。
@Effect()
applyInspectionsFilters$: Observable<Action> = this.actions$.pipe(
ofType(
InspectionsPageActions.applyInspectionsFilters.type,
InspectionsPageActions.clearSelectedInspectionsFilters.type,
InspectionsPageActions.removeSelectedStatusFilter.type,
InspectionsPageActions.removeSelectedAttributeFilter.type,
InspectionsPageActions.removeSelectedUserFilter.type,
InspectionsPageActions.removeNotAssignedUsersFilter.type
),
withLatestFrom(
this.store$.pipe(select(fromInspections.getSelectedInspectionsFilters))
),
switchMap(([action, filters]) =>
...
)
);
当他们库中参数的最大数量为5时,我应该怎么做?
文档在这里:https://ngrx.io/api/effects/ofType
显示方法是这样的:
ofType(
...[InspectionsPageActions.applyInspectionsFilters.type,
InspectionsPageActions.clearSelectedInspectionsFilters.type,
InspectionsPageActions.removeSelectedStatusFilter.type,
InspectionsPageActions.removeSelectedAttributeFilter.type,
InspectionsPageActions.removeSelectedUserFilter.type,
InspectionsPageActions.removeNotAssignedUsersFilter.type]
),