source: Farmatiko/ClientApp/src/app/fetch-data/fetch-data.component.ts@ 42e2397

Last change on this file since 42e2397 was 822c59d, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago

Initial commit

  • Property mode set to 100644
File size: 612 bytes
RevLine 
[822c59d]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.