In Angular 4's HTTP package ('@angular/http'), a URLSearchParams object can be passed in the get request. When assigning the parameters object in the request method, what is the difference between using search and params as the attribute to pass the value into?
For example, what is the difference between the following two pieces of code:
let params = new URLSearchParams();
params.set('param1', 'xyz');
this.http.get('url', { search: params });
and
let params = new URLSearchParams();
params.set('param1', 'xyz');
this.http.get('url', { params: params });
Many thanks.
Search is deprecated since 4.0 and params is preferred way of passing query params.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With