我有一个联系方式页面。在编辑该页面并单击“提交”时,我正在处理“提交成功”操作,如下所示: Angular @ 4,ngrx @ 2.2.1,rxjs @ 6.2
import { go,routeractions,replace } from '@ngrx/router-store';
@Effect()
public gotoContactDetailSection = this._actions$.pipe (
ofType<ViewContactInfoaction>(someaction),map(action => action.payload),switchMap(p =>
[
go({ path: [ p.plan,p.scheme,p.primaryKey,p.section ]}),new AddSuccessToastaction('Update Success') // Implementation of ngrx,action class with type = ''[toaster] add''.
]
)
);
“ go”用于导航到某个页面,该页面用于调度“ NavigationStart”上的“ [toaster] remove”操作。
已调度动作的输出顺序: “ [[烤面包机]删除”,“ [路由器]转到”,“ [烤面包机]添加”
升级到Angular 7和ngrx 6后,ngrx删除了Router actions(执行,返回,替换等),我不得不按照ngrx迁移指南的建议创建自定义操作,现在,自定义“ Go”操作已由调用“ router.navigate()”,我的效果更改为:
Angular @ 7,ngrx @ 7.4,rxjs @ 6.3
@Effect()
public gotoContactDetailSection = this._actions$.pipe (
ofType<fromAppHeader.ViewContactInfoaction>(AppHeaderactions.VIEW_CONTact_INFO),map(p =>
[
new go({ path: [ p.plan,// Custom implementatin of "
[Router] Go" action.
new AddSuccessToastaction('Update Success') // Implementation of ngrx,action class with type = '[toaster] add'.
])
);
已调度动作的输出顺序:
"[toaster] add"
"[Router] Go"
"@ngrx/router-store/request"
"[toaster] remove"
"@ngrx/router-store/navigation"
"@ngrx/router-store/navigated"
现在我的问题是,我想在“ [Router] Go”操作之后分派“ [toaster] add”(包括被router.navigate隐式调用的请求,导航和导航),以便添加的吐司是无法通过“ [烤面包机]删除”操作删除。
自定义操作“执行”已按照“ https://ngrx.io/guide/migration/v4”中“导航操作”部分的建议实施。