Ser*_*nar 2 typescript ngrx ngrx-effects angular
我必须在超过5个动作中使用ofType。
@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]) =>
...
)
);
Run Code Online (Sandbox Code Playgroud)
当其库中参数的最大数量为5时,该怎么办?
docs here: https://ngrx.io/api/effects/ofType
show the way to do it is something like this:
ofType(
...[InspectionsPageActions.applyInspectionsFilters.type,
InspectionsPageActions.clearSelectedInspectionsFilters.type,
InspectionsPageActions.removeSelectedStatusFilter.type,
InspectionsPageActions.removeSelectedAttributeFilter.type,
InspectionsPageActions.removeSelectedUserFilter.type,
InspectionsPageActions.removeNotAssignedUsersFilter.type]
),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
164 次 |
| 最近记录: |