Hi I’m looking for an elegant and solid way to share “complex” data between two pages, i.e. passing a generic object when navigating from page A to page B.
I know it is possible to:
serialize it and pass it along the
navigationExtras.queryParamsproperty of the router’s
Share an Injectable class between A and B, and let the two pages read/write on the same property
However none of these solutions seems very elegant to me. Serializing is never a very attractive solution, while I have some design concerns about sharing information using an injectable class option (for example, this information will persist in the application even after the specific page transition which is consuming it has been complited. Plus if other components inject such class, they will get access to this data, and the ability to read it and even modify it).
I’m rather looking for something like Android’s context sharing, since differently from a single page web application, in a mobile application - where the Page concept comes into play - is pretty common the need to pass a context when entering a new page.