diff --git a/additional-documentation/summary.json b/additional-documentation/summary.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/additional-documentation/summary.json @@ -0,0 +1 @@ +{} diff --git a/documentation/components/AppComponent.html b/documentation/components/AppComponent.html new file mode 100644 index 0000000..83e8da6 --- /dev/null +++ b/documentation/components/AppComponent.html @@ -0,0 +1,477 @@ + + +
+ + ++
+ src/app/app.component.ts
+
+
+ OnInit
+
selector | +app-root |
+
styleUrls | +app.component.css |
+
templateUrl | +./app.component.html |
+
+ Properties+ |
+
+
|
+
+ Methods+ |
+
+
|
+
+constructor(weatherService: WeatherService)
+ |
+ ||||||
+ Defined in src/app/app.component.ts:11
+ |
+ ||||||
+
+ Parameters :
+
+
|
+
+ + + + getWeatherData + + + + | +
+getWeatherData()
+ |
+
+ Defined in src/app/app.component.ts:15
+ |
+
+
+
+ Returns :
+ void
+
+ |
+
+ + + + ngOnInit + + + + | +
+ngOnInit()
+ |
+
+ Defined in src/app/app.component.ts:21
+ |
+
+
+
+ Returns :
+ void
+
+ |
+
+ + + + Public + weatherData + + + + | +
+ weatherData:
+ |
+
+ Type : Weatherdata[]
+
+ |
+
+ Default value : []
+ |
+
+ Defined in src/app/app.component.ts:11
+ |
+
import { Component, OnInit } from '@angular/core';
+import { WeatherService } from './weather.service';
+import { Weatherdata } from '../interfaces/WeatherData';
+
+@Component({
+ selector: 'app-root',
+ templateUrl: './app.component.html',
+ styleUrls: ['./app.component.css']
+})
+export class AppComponent implements OnInit {
+ public weatherData: Weatherdata[] = [];
+
+ constructor(private weatherService: WeatherService) {}
+
+ getWeatherData(): void {
+ this.weatherService.getWeatherData().subscribe(data => {
+ this.weatherData = data;
+ });
+ }
+
+ ngOnInit() {
+ this.getWeatherData();
+ }
+}
+
+ <div>
+ <div>Temp:
+ <span *ngIf="weatherData;else loading">
+ {{ weatherData.main.temp }}
+ </span>
+ <ng-template #loading>lädt</ng-template>°
+ </div>
+
+</div>
+ File | +Type | +Identifier | +Statements | +
---|---|---|---|
+ + src/app/app.component.ts + | ++ component + | ++ AppComponent + | ++ 0 % + (0/5) + | +
+ + src/app/weather.service.ts + | ++ injectable + | ++ WeatherService + | ++ 0 % + (0/4) + | +
+ + src/environments/environment.prod.ts + | ++ variable + | ++ environment + | ++ 0 % + (0/1) + | +
+ + src/environments/environment.ts + | ++ variable + | ++ environment + | ++ 0 % + (0/1) + | +
+ + src/interfaces/WeatherData.ts + | ++ interface + | ++ Weatherdata + | ++ 0 % + (0/6) + | +
This project was generated with Angular CLI version 6.2.4.
+Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
+
+ src/app/weather.service.ts
+
+ Properties+ |
+
+
|
+
+ Methods+ |
+
+
|
+
+constructor(http: HttpClient)
+ |
+ ||||||
+ Defined in src/app/weather.service.ts:10
+ |
+ ||||||
+
+ Parameters :
+
+
|
+
+ + + + Public + getWeatherData + + + + | +
+
+ getWeatherData()
+ |
+
+ Defined in src/app/weather.service.ts:14
+ |
+
+
+
+ Returns :
+ Observable<any[]>
+
+ |
+
+ + + + WEATHER_API_URL + + + + | +
+ WEATHER_API_URL:
+ |
+
+ Default value : environment.WEATHER_API_URL
+ |
+
+ Defined in src/app/weather.service.ts:12
+ |
+
import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { Weatherdata } from '../interfaces/WeatherData';
+import { environment } from '../environments/environment';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class WeatherService {
+ constructor(private http: HttpClient) {}
+ WEATHER_API_URL = environment.WEATHER_API_URL;
+
+ public getWeatherData(): Observable<any[]> {
+ const { prefix, base, cityId, key } = this.WEATHER_API_URL;
+ const _url = `${prefix}${base}?id=${cityId}&appid=${key}`;
+ return this.http.get<Weatherdata[]>(_url);
+ }
+}
+
+ +
+ src/interfaces/WeatherData.ts
+
+ Properties+ |
+
+ + | +
+ + humidity + | +
+ humidity:
+ |
+
+ Type : number
+
+ |
+
+ + pressure + | +
+ pressure:
+ |
+
+ Type : number
+
+ |
+
+ + temp + | +
+ temp:
+ |
+
+ Type : number
+
+ |
+
+ + temp_max + | +
+ temp_max:
+ |
+
+ Type : number
+
+ |
+
+ + temp_min + | +
+ temp_min:
+ |
+
+ Type : number
+
+ |
+
export interface Weatherdata {
+ temp: number;
+ pressure: number;
+ humidity: number;
+ temp_min: number;
+ temp_max: number;
+ // coord: Coord;
+ // weather: Weather[];
+ // base: string;
+ // main: Main;
+ // visibility: number;
+ // wind: Wind;
+ // clouds: Clouds;
+ // dt: number;
+ // sys: Sys;
+ // id: number;
+ // name: string;
+ // cod: number;
+}
+
+// export interface Clouds {
+// all: number;
+// }
+
+// export interface Coord {
+// lon: number;
+// lat: number;
+// }
+
+// export interface Main {
+// temp: number;
+// pressure: number;
+// humidity: number;
+// temp_min: number;
+// temp_max: number;
+// }
+
+// export interface Sys {
+// type: number;
+// id: number;
+// message: number;
+// country: string;
+// sunrise: number;
+// sunset: number;
+// }
+
+// export interface Weather {
+// id: number;
+// main: string;
+// description: string;
+// icon: string;
+// }
+
+// export interface Wind {
+// speed: number;
+// deg: number;
+// }
+//
+
+