我迁移到使用ngrx效果,并且我有以下问题:由于dispatch返回void,所以我不确定如果从ngrx效果发生错误(例如来自this.userAccountService.updateFirstName(...),如何防止路由器导航。
在我的组件类中:
updateFirstName() {
this.formStatus.submitted = true;
if (this.formStatus.form.valid) {
//Dispatch from the store
this.store.dispatch(new UpdateFirstN
错误的意思是,它在action参数之后在.map中使用逗号。
在DataActions.AddDataAction上盘旋时也有一个错误,上面写着Tuple type '[Action, AppStore]' with length '2' cannot be assigned to tuple with length '5'
@Effect() addData$ = this.actions$
.ofType(DataActions.ADD_DATA)
.withLatestFrom(this.store$)
.map((
我需要帮助处理我的密码。我是新的角度,我有一个问题,关于ngrx的效果。因此,在我的auth服务中,我声明了一个登录失败,它的类型是可观察的,我希望当我的身份验证在登录失败时,旋转器停止旋转并再次输入数据。在ngrx/效果中我应该添加哪些部分?
服务组件
public loginFailed: Observable<boolean>;
NGRX/效应
@Effect()
public login$: Observable<any> =
this.actions$.pipe(
ofType(AuthActionTypes.LoginAction),
m
@effect()
public loadAccommodations$: Observable = this.actions$
.ofType(PAA.PROPERTY_LOAD_REQUEST)
// .debounce(300)
// introducing this mitigates the flood but does not resolve the issue
.switchMap((action: Action) => {
return this.propertyAccommodationsService.loadAccommo
我收到了一套测试用例较少的测试套装,并使用NgRx进行了Range2应用示例。我无法通过一个测试用例,我也不确定该测试用例是否正确。
我的问题是NgRx store.dispatch方法是否接受字符串作为参数?
如果没有,那么如何通过这个测试用例?
如果是,您能帮助我理解如何在这种情况下实现Action和reducer吗?
有麻烦的测试用例:
it('should dispatch action when dispatchAction is called', async() => {
// you need to spy on store's 'dis