首页 文章

如何将ngrx存储库注入库中

提问于
浏览
0

我正在创建一个拖放角度模块,我希望将其外部化并发布到npm . 该库基本上允许用户定义拖放区域并将ngrx操作与它们相关联 .

const DND_RULES: DndRule[] = [
   new DndRule('area1', 'area2', MOVE_AREA1_TO_AREA2_ACTION.getAction),
   new DndRule('area2', 'area1', COPY_AREA2_TO_AREA2_ACTION.getAction),
]

然后,提供的服务将分派由该规则产生的操作 .

我的问题是我需要将这个库与消费者的商店集成 . Is there a way to provide the ngrx store via some static module method or link it to my store behind the scenes in some way? DndModule.provideStore(???) 我不确定幕后会是什么样子

1 回答

  • 1

    您可以查看路由器存储的实现方式,https://github.com/ngrx/router-store . 尝试使用您的商店的人必须进行一些配置并导入他们想要使用的必要操作 . import { go, replace, search, show, back, forward } from '@ngrx/router-store';

相关问题