I think it’s worth stating that there can be an efficiency trade off because all methods become instance methods rather than prototype methods. If you build a lot of objects then garbage collection might take longer.
Can someone verify? 😬
But I love the pattern otherwise. It’s not always necessary but probably more often useful than not.
I appreciate feedback, especially when it’s well articulated. I’m open to editing my article but I need to understand what you are exactly criticizing.
First, the article presents a very basic and limited version of functional programming that will “improve code readability”. I understand that the core of functional…
Thank you for the clarification!
Are you certain? This is from the angular documentation.
switchMap operator also cancels previous in-flight requests. If the user re-navigates to this route with a new
id while the
HeroService is still retrieving the old
switchMap discards that old request and returns the hero for the new
I’m not completely sure how to do this off the top of my head. So I’ll need some time to give a good answer.
In the meantime, here’s the HttpClient Get method documentation. In that, you can send a url (with a query string), you can send headers, and you can send HttpParams. I haven’t tested this out but here’s what I think…