Angular Ngrx-使用其他模块的效果

Angular Ngrx-使用其他模块的效果,angular,ngrx,ngrx-effects,Angular,Ngrx,Ngrx Effects,您好,我有一个效果,在点击按钮分派新动作来创建一些东西之后 @Effect({dispatch: false}) createSomething$ = this._actions$.pipe( ofType( clientsActions.Create), mergeMap((action) => this._service.add(action.payload) .pipe( tap(() => this._r

您好,我有一个效果,在点击按钮分派新动作来创建一些东西之后

@Effect({dispatch: false})
createSomething$ = this._actions$.pipe(
    ofType(
        clientsActions.Create),
    mergeMap((action) => this._service.add(action.payload)
        .pipe(
            tap(() => this._router.navigate(['somewhere'])),
            catchError(error => of())
        ))
);
这是很好的工作,效果发送请求和重定向,但现在我想添加,来自根模块中的其他类的操作,但是,当我尝试这样做时

@Effect({dispatch: false})
createSomething$ = this._actions$.pipe(
    ofType(
        clientsActions.Create),
    mergeMap((action) => this._service.add(action.payload)
        .pipe(.map(() => ({type: this.otherActions.doAction),
            tap(() => this._router.navigate(['somewhere'])),
            catchError(error => of())
        ))
);

这不起作用,其他操作什么都不做,甚至没有显示在开发工具中,现在我对发生了什么感到困惑。我还尝试了concatMap等。

使用MergeMap和返回数组[{type:actionType}]

@Effect({dispatch: false})
createSomething$ = this._actions$.ofType(clientsActions.Create)
.pipe(
    mergeMap((action) => this._service.add(action.payload).pipe(
        mergeMap(() => ([{type: this.otherActions.doAction}]),
        tap(() => this._router.navigate(['somewhere'])),
        catchError(error => of())
        ))
);

使用MergeMap和返回数组[{type:actionType}]

@Effect({dispatch: false})
createSomething$ = this._actions$.ofType(clientsActions.Create)
.pipe(
    mergeMap((action) => this._service.add(action.payload).pipe(
        mergeMap(() => ([{type: this.otherActions.doAction}]),
        tap(() => this._router.navigate(['somewhere'])),
        catchError(error => of())
        ))
);