Skip to content

Commit 0337a2b

Browse files
author
Andrew Evans
committed
fixing error with long coordinate values
1 parent c92fc3d commit 0337a2b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/app/weather/weather.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import { LoadWeather } from '../actions/weather.actions';
2626
})
2727
export class WeatherComponent implements OnInit {
2828

29-
lat: string;
30-
long: string;
3129
cardsDesktop = [];
3230
cardsMobile = [];
3331
displayValues = false;
@@ -188,8 +186,10 @@ export class WeatherComponent implements OnInit {
188186
onSelectionChanged(event: MatAutocompleteSelectedEvent) {
189187
for (const city of this.cities) {
190188
if (city.combinedName === event.option.value) {
191-
this.locationData.latitude = city.latitude;
192-
this.locationData.longitude = city.longitude;
189+
const latitude = parseFloat(city.latitude);
190+
const longitude = parseFloat(city.longitude);
191+
this.locationData.latitude = latitude.toFixed(4).toString();
192+
this.locationData.longitude = longitude.toFixed(4).toString();
193193
this.store.dispatch(new LoadWeather({weatherData: null}));
194194
this.store.dispatch(new LoadLocations({locationData: this.locationData, error: null}));
195195
break;

0 commit comments

Comments
 (0)