I want to get the query params from an get request. Interceptor code is this way,
export class FixtureInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(req);
}
}
i tried to get the params using get method like this ,
req.params.get('category');
but it returns me null always. My api call is this way ,
getValue() {
return this.http.get('http://139.49.10.175:3000/laundryItems?category=2&type=4');
}
i need value of category and type from above API call
Apparently params directly putted in url doesn't appear in req.params, this one should work:
getValue() {
return this.http.get('http://139.49.10.175:3000/laundryItems', {params: {category: '2', type: '4'}});
}
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