Update fetch-data.component.ts
This commit is contained in:
parent
50833cc8f9
commit
dc3d1815cf
|
|
@ -1,16 +1,16 @@
|
||||||
import { Component, Inject } from "@angular/core";
|
import { Component, Inject } from '@angular/core';
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-fetch-data",
|
selector: 'app-fetch-data',
|
||||||
templateUrl: "./fetch-data.component.html"
|
templateUrl: './fetch-data.component.html'
|
||||||
})
|
})
|
||||||
export class FetchDataComponent {
|
export class FetchDataComponent {
|
||||||
public forecasts: WeatherForecast[];
|
public forecasts: WeatherForecast[];
|
||||||
|
|
||||||
constructor(http: HttpClient, @Inject("BASE_URL") baseUrl: string) {
|
constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
|
||||||
http
|
http
|
||||||
.get<WeatherForecast[]>(baseUrl + "api/SampleData/WeatherForecasts")
|
.get<WeatherForecast[]>(baseUrl + 'api/SampleData/WeatherForecasts')
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
this.forecasts = result;
|
this.forecasts = result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue