将 DTO 对象传递给 Angular Modal [英] Pass DTO Object to Angular Modal
问题描述
所以,我有一个子模式,我想将 DTO 对象作为参数传递给它,该行将如下所示:
So, I have a child modal that I want to pass a DTO Object to as argument, the line would be such as:
[routerLink]="['/', { outlets: { popup: 'apiDosageDialogFirstStep/'+ formDTO } }]"
我已经知道有(或曾经)显然无法通过 routerLink 传输复杂对象的艰难方法.然而,我发现的回复大多类似于 这个问题,这对我没有用,因为我的对象是数据传输对象,并且在要查询的数据库上没有物理参考
I've learned the hard way that there is (or was) apparently no way to transfer complex objects via routerLink. However the reply I find mostly is like the one on this question, which is not useful to me as my object is a Data Transfer one and has no physical reference on a database to query for
那么,我想知道是否有人遇到过类似的问题,以及哪些库/解决方法最适合?
So, I'd like to know if anyone has faced similar issue and what libraries / workarounds could suit best?
推荐答案
我使用 ngrx 作为状态管理库,所以一切都在中心位置.在导航到出口弹出窗口时,我从 ngrx-store 获取 dto.
I use ngrx as state management library, so everything is in central place. While navigating to outlet popup, I fetch dto from ngrx-store.
希望对你有帮助.
如果您不使用 ngrx,那么只有通过从 service 订阅 DTO 对象来获取该 DTO 的方法,我认为在您提供的链接中有问题.
If you are not using ngrx then only way to get that DTO by subscribing DTO Object from service, I think it is said in the link that you given in question.
这篇关于将 DTO 对象传递给 Angular Modal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!