I am developing a very simple weather app in Angular and I wanted to ask you if you think there are better ways to choose a certain image based on the "type" of weather codition.
enum WeatherCodition { Thunderstorm = 0, Drizzle, Rain, Snow, Clear, Clouds }
export class Weather {
getIcon(condition: WeatherCodition): string {
var iconPath = "";
switch(condition){
case WeatherCodition.Thunderstorm:
iconPath = "thunderstorm.png";
break;
default:
iconPath = "clear.png"
}
return iconPath;
}
}
Aucun commentaire:
Enregistrer un commentaire