I am trying to pass a variable in my get request in Angular 7. how do you correctly set a variable in the middle of the url;
export class dataService {
constructor(private http: HttpClient) { }
getUsers(userName){
return this.http.get('/***/****/***/${userName}/keychain****);
}
}
Use Template Strings. You can attach your variables using the dollar syntax ${your_variable}
.
this.http.get(`/services/cxadmin/${userName}/japplegate/keychain');