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

Last change on this file since e42f61a was ef1219a, checked in by Mile Jankuloski <mile.jankuloski@…>, 4 years ago

Handled REST API calls, searchbars and paginators implemented, overall frontend improvment

  • Property mode set to 100644
File size: 647 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 console.log(this.forecasts);
15 }, error => console.error(error));
16 }
17}
18
19interface WeatherForecast {
20 date: string;
21 temperatureC: number;
22 temperatureF: number;
23 summary: string;
24}
Note: See TracBrowser for help on using the repository browser.