/
qwiklly
/
arc-server
Обзор
Документация
Войти
/
qwiklly
/
arc-server
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
client/src/app/fetch-data/fetch-data.component.ts
23 строки
617 B
CLTanuki
feat: initial
13 июл 2022, 19:02
13 июл 2022, 19:02
2868bb8
Код
Авторство
О чём код?
import { Component, Inject } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-fetch-data', templateUrl: './fetch-data.component.html' }) export class FetchDataComponent { public forecasts: WeatherForecast[] = []; constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) { http.get<WeatherForecast[]>(baseUrl + 'weatherforecast').subscribe(result => { this.forecasts = result; }, error => console.error(error)); } } interface WeatherForecast { date: string; temperatureC: number; temperatureF: number; summary: string; }