Angular 如何在操作文件中使用entityActionFactory来定制ngrx/data中的操作?
我看到我们可以在ngrx/data中自定义我们的操作,如下所示 因此,我的问题是如何在正常的***.actions.ts文件(示例)中创建这些自定义操作 这可能吗?Angular 如何在操作文件中使用entityActionFactory来定制ngrx/data中的操作?,angular,redux,ngrx,angular-ngrx-data,ngrx-data,Angular,Redux,Ngrx,Angular Ngrx Data,Ngrx Data,我看到我们可以在ngrx/data中自定义我们的操作,如下所示 因此,我的问题是如何在正常的***.actions.ts文件(示例)中创建这些自定义操作 这可能吗? 非常感谢您可以在商店中将其创建为对象,然后通过useValue将其提供到模块中,与模块化服务共享 export const myEntityActionFactory=new EntityActionFactory(); //为了避免重复,您需要将其分配给window.myEntityActionFactory并创建一个gett
非常感谢您可以在商店中将其创建为对象,然后通过
useValue
将其提供到模块中,与模块化服务共享
export const myEntityActionFactory=new EntityActionFactory();
//为了避免重复,您需要将其分配给window.myEntityActionFactory并创建一个getter函数。
//在某处使用它。
@NGD模块({
进口:[
EntityDataModule.forRoot(…),
],
规定:[
{
提供:EntityActionFactory,
使用价值:myEntityActionFactory,
},
],
})
import { createAction, props } from '@ngrx/store';
export const normalFooAction = createAction(
‘[Foo] foo’,
props<{ foo: string }>()
);
¿¿¿
export const customizedNRGXDataAction = createAction(
———
this.entityActionFactory.create<Hero>(
'Hero',
EntityOp.QUERY_ALL,
null,
{ tag: 'Load Heroes On Start' }
);
———
???
@Injectable()
export class FooEffects {
***
¿¿¿
loadCustomizedNRGXDataAction$ = createEffect(() => this.actions$.pipe(
ofType(FooActions.customizedNGRXDataAction),
???
***
))
)
);