From bce75e76fe5334add9cff5d91c3d5dfd6fb446a9 Mon Sep 17 00:00:00 2001 From: MarcusFerl Date: Thu, 22 Sep 2022 19:32:00 +0200 Subject: [PATCH] xs --- .gitignore | 1 + src/app/current-weather/current-weather.component.html | 6 +++--- src/app/current-weather/current-weather.component.ts | 7 ++++--- src/app/forcast-weather/forcast-weather.component.scss | 7 +++++-- src/app/weather-api.service.ts | 9 ++++++--- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 0711527..0162b46 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ testem.log # System files .DS_Store Thumbs.db +src/environments/environment.ts diff --git a/src/app/current-weather/current-weather.component.html b/src/app/current-weather/current-weather.component.html index 28f491b..a74d6d4 100644 --- a/src/app/current-weather/current-weather.component.html +++ b/src/app/current-weather/current-weather.component.html @@ -1,14 +1,14 @@
- Min - Max + Aktuell - Max {{weatherData?.calendarDayTemperatureMax?.at(0)}} C° -

Min {{weatherData?.calendarDayTemperatureMin?.at(0)}} C°

+ {{weatherData?.temperature?.toString()}} C° +
\ No newline at end of file diff --git a/src/app/current-weather/current-weather.component.ts b/src/app/current-weather/current-weather.component.ts index 93caf4d..9c52609 100644 --- a/src/app/current-weather/current-weather.component.ts +++ b/src/app/current-weather/current-weather.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { WeatherData } from '../models/weather.model'; +import { Daypart, WeatherData } from '../models/weather.model'; import { WeatherApiService } from '../weather-api.service'; @Component({ @@ -12,15 +12,16 @@ export class CurrentWeatherComponent implements OnInit { constructor(public service: WeatherApiService) { } - weatherData?: WeatherData + weatherData?: Daypart ngOnInit(): void { - this.service.getData() + this.service.getDayPart() .subscribe({ next: (response) => { this.weatherData = response; } }); + alert(this.weatherData?.temperature?.toLocaleString) } } diff --git a/src/app/forcast-weather/forcast-weather.component.scss b/src/app/forcast-weather/forcast-weather.component.scss index 29ae6c3..27c38c1 100644 --- a/src/app/forcast-weather/forcast-weather.component.scss +++ b/src/app/forcast-weather/forcast-weather.component.scss @@ -49,6 +49,9 @@ border-right: 2px solid white; - border-collapse: separate; - border-spacing: 15px 50px 50px 50px; + padding-right: 15px; + +} +mat-card-title{ + margin-bottom: 30px; } \ No newline at end of file diff --git a/src/app/weather-api.service.ts b/src/app/weather-api.service.ts index 5fd351a..b22a84e 100644 --- a/src/app/weather-api.service.ts +++ b/src/app/weather-api.service.ts @@ -1,13 +1,14 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { WeatherData } from './models/weather.model'; +import { Daypart, WeatherData } from './models/weather.model'; +import { environment } from 'src/environments/environment'; @Injectable({ providedIn: 'root' }) export class WeatherApiService { -url:string = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=49.9667,7.9046&format=json&units=m&language=de-DE&apiKey=bd2007c3853d41bba007c3853d21bbb1"; +url:string = environment.weatherApiBaseUrl; temp:any @@ -17,6 +18,8 @@ constructor(private http:HttpClient) {} getData():Observable{ return this.http.get(this.url) } - +getDayPart(): Observable{ + return this.http.get(this.url) +} } \ No newline at end of file