Pass DTO Object to Angular Modal

2019-08-16 16:42发布

问题:

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 } }]"

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?

回答1:

I use ngrx as state management library, so everything is in central place. While navigating to outlet popup, I fetch dto from ngrx-store.

I hope this will help to you.

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.