ngrx-query
ngrx-query copied to clipboard
Adding params to the requests
I've begun integrating this into our project as it looks like a promising way to cut down repetition for requests (of which there are a considerable amount). One small thing I ran into however was adding params to the requests -- which we do for almost all requests -- which now has to be done with string concatenation. This feels fairly clunky compared to e.g. @angular/http/common which allows passing a map of the params.
What is your opinion on providing a optional key params to the RequestParam type? If you are interested I can see if I can make a PR.
Yeah, that sounds like a useful PR. I'd merge that.
If params is undefined use the url without modifications.
If params is defined, then:
- Format the keys and values in the params object like this
[key]=[value]and join them with an&2.a. If the url already has a?, append the params string with an&2.b. If the url does not have a?, append the params string with a?
Anything I'm missing?
Tests and documentation are always appreciated.