I am calling an API using Get method, I want to just get the 'Query string parameters' which has been appended from backend. For example https://api.npms.io/v2/search?q=scope:angular&lang='fr''
. From this API lang='fr'
has been appended from backend. I need to get the last 'query parameters' lang='fr'
.
app.component.ts
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({ selector: 'app', templateUrl: 'app.component.html' })
export class AppComponent implements OnInit {
totalAngularPackages;
constructor(private http: HttpClient) { }
ngOnInit() {
// Simple GET request with response type <any>
this.http.get<any>('https://api.npms.io/v2/search?q=scope:angular&lang='fr'').subscribe(data => {
this.totalAngularPackages = data.total;
})
}
}