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 | |
---|
1 | import { Component, Inject } from '@angular/core';
|
---|
2 | import { HttpClient } from '@angular/common/http';
|
---|
3 |
|
---|
4 | @Component({
|
---|
5 | selector: 'app-fetch-data',
|
---|
6 | templateUrl: './fetch-data.component.html'
|
---|
7 | })
|
---|
8 | export 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 |
|
---|
19 | interface WeatherForecast {
|
---|
20 | date: string;
|
---|
21 | temperatureC: number;
|
---|
22 | temperatureF: number;
|
---|
23 | summary: string;
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.