The map in my project is generated using the countries-map
plugin and includes data values. Here is an example of the data provided by the plugin:
mapData: CountriesData = {
'ES': { 'value': 416 },
'GB': { 'value': 94},
'FR': { 'value': 255 }
};
This data is structured based on the following interfaces:
interface CountriesData {
[countryCode: string]: CountryData;
}
interface CountryData {
value: number;
extra?: CountryExtraData;
}
interface CountryExtraData {
[key: string]: number |string;
}
When my API returns data, it provides a map format like this:
{
"countryInstallHistory": {
"DZ": 1,
"SN": 3
}
}
In my Angular project, I am able to iterate through the list of countries using the following code:
for (let [key, result] of Object.entries(this.apkHistorDto.countryInstallHistory)) {
console.log(key)
console.log(result)
}
I am wondering how I can create a new map based on the data sent by my API, following the same interface structure. Any advice or guidance would be greatly appreciated. Thank you.