I need assistance with passing the value of a mat-select dropdown from the component file to the service file in my API setup. Currently, I have the country code hardcoded as 'au', but I would like it to be set dynamically based on the selected value from the mat-select dropdown.
Here is the code snippet for fetching the mat-select value in the Component File:
onCountrySelection() {
console.log(this.countryValue);
}
This is how the API is implemented in the Service Class File:
uploadConfig(templateName, JsonBody) {
const header = new HttpHeaders().set(
'Authorization',
'Bearer ' + sessionStorage.getItem('token'),
).set(
'country',
'au'
);
return this.httpClient.post(
this.localUrl + '/pattern/' + templateName + '/flow', JsonBody,
{ headers: header });
}
I am looking for a way to pass the console.log value from the Component to the Service file. Can anyone provide guidance on how to achieve this?