TNG / ngqp

Declaratively synchronize form controls with the URL
https://tng.github.io/ngqp
MIT License
81 stars 8 forks source link

Add objectParam #119

Closed Airblader closed 5 years ago

Airblader commented 5 years ago

What's your idea?

We have stringParam, booleanParam etc. It would be good to add objectParam which by default uses JSON stringify/parse for (de-)serialization.

alexey-anufriev commented 5 years ago

But how would that be represented in URL? http://my-site.com/index.html?objParam={a:1,b:2}?

Airblader commented 5 years ago

Yeah, plus any URL encoding that is done to it. This may seem odd – and for me it is – but the Angular router does JSON stringify by default for query parameters when necessary while ngqp requires an explicit serializer.

I think we don't need to be opionated here given how trivial supporting this would be. :-)

Airblader commented 5 years ago

I've somewhat changed my mind, for now anyway. For this to be useful and "complete" we would have to provide a smarter compareWith function, but I would sort of like to avoid being opionated about its implementation. So I'll close this for now.