Angular ngrx效应';s动作不触发减速器

Angular ngrx效应';s动作不触发减速器,angular,ngrx,ngrx-effects,Angular,Ngrx,Ngrx Effects,我的Angular 5代码在没有ngrx效果的情况下工作。在添加effect并发送HTTP请求后,我无法触发操作调用reducer。我的效果是这样的。此控制台日志被正确的http响应击中 @Injectable() export class PropertyEffects { @Effect({dispatch: false}) propertyFetch$: Observable<Action> = this.actions$//.pipe( .ofType(Propert

我的Angular 5代码在没有ngrx效果的情况下工作。在添加effect并发送HTTP请求后,我无法触发操作调用reducer。我的效果是这样的。此控制台日志被正确的http响应击中

@Injectable()
export class PropertyEffects {
@Effect({dispatch: false})
propertyFetch$: Observable<Action> = this.actions$//.pipe(
    .ofType(PropertyActions.FETCH_ALL_PROPERTIES)
    .switchMap(action =>
       this.httpClient.get('https://yxalbf1t6l.execute-api.us-east-1.amazonaws.com/dev/todos').pipe(
            // If successful, dispatch success action with result
            map(data => {
                console.log(`Success ${JSON.stringify(data)}, 0, 2)`);
                return new PropertyActions.OpenAllProperties(data)
            })
    )
); 

请帮忙。谢谢大家!

您正在传递一个参数以停止分派事件。这不会触发reducer函数,因为它不会分派任何内容

如果要验证它,请使用


在这里,您将看到应用程序中的所有分派事件。

您正在传递一个参数以停止分派事件。这不会触发reducer函数,因为它不会分派任何内容

performSearchAction$: Observable<Action> = createEffect(
() =>
  this.actions$.pipe(
    ofType(actions.searchAction),

    switchMap(data =>
      this.apiService.getSearch(data).pipe(
        tap(x => console.log('searchResponseData', x)),
        map(searchResponseData => actions.searchSuccessAction(searchResponseData)),
        catchError(error => of(actions.searchFailureAction(error)))
      )
    )
  ),
{ dispatch: true, resubscribeOnError: false } // dispatch: true
如果要验证它,请使用

在这里,您将看到应用程序中的所有分派事件。

performSearchAction$:Observable=createEffect(
performSearchAction$: Observable<Action> = createEffect(
() =>
  this.actions$.pipe(
    ofType(actions.searchAction),

    switchMap(data =>
      this.apiService.getSearch(data).pipe(
        tap(x => console.log('searchResponseData', x)),
        map(searchResponseData => actions.searchSuccessAction(searchResponseData)),
        catchError(error => of(actions.searchFailureAction(error)))
      )
    )
  ),
{ dispatch: true, resubscribeOnError: false } // dispatch: true
() => 此.actions$管道( 类型(actions.searchAction), 开关映射(数据=> 这个.apiService.getSearch(数据).pipe( 点击(x=>console.log('searchResponseData',x)), 映射(searchResponseData=>actions.searchSuccessAction(searchResponseData)), catchError(error=>of(actions.searchFailureAction(error))) ) ) ), {分派:true,重新订阅者错误:false}//分派:true
))

提示:如果使用ngrx8
performSearchAction$:Observable=createEffect,请记住设置:dispatch:true(
() =>
此.actions$管道(
类型(actions.searchAction),
开关映射(数据=>
这个.apiService.getSearch(数据).pipe(
点击(x=>console.log('searchResponseData',x)),
映射(searchResponseData=>actions.searchSuccessAction(searchResponseData)),
catchError(error=>of(actions.searchFailureAction(error)))
)
)
),
{分派:true,重新订阅者错误:false}//分派:true
))


提示:如果使用NGRX8,请记住设置:dispatch:true。我认为
{dispatch:false}
参数正在阻止传递操作。我认为
{dispatch:false}
参数正在阻止传递操作。