source: Farmatiko/ClientApp/src/app/fetch-data/fetch-data.component.ts@ 92a1f41

Last change on this file since 92a1f41 was 30a465f, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago

Initial commit

  • Property mode set to 100644
File size: 612 bytes
Line 
1import { Component, Inject } from '@angular/core';
2import { HttpClient } from '@angular/common/http';
3
4@Component({
5 selector: 'app-fetch-data',
6 templateUrl: './fetch-data.component.html'
7})
8export class FetchDataComponent {
9 public forecasts: WeatherForecast[];
10
11 constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
12 http.get<WeatherForecast[]>(baseUrl + 'weatherforecast').subscribe(result => {
13 this.forecasts = result;
14 }, error => console.error(error));
15 }
16}
17
18interface WeatherForecast {
19 date: string;
20 temperatureC: number;
21 temperatureF: number;
22 summary: string;
23}
Note: See TracBrowser for help on using the repository browser.