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 { HttpClient } from "@angular/common/http";
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
@Component({
|
||||
selector: "app-fetch-data",
|
||||
templateUrl: "./fetch-data.component.html"
|
||||
selector: 'app-fetch-data',
|
||||
templateUrl: './fetch-data.component.html'
|
||||
})
|
||||
export class FetchDataComponent {
|
||||
public forecasts: WeatherForecast[];
|
||||
|
||||
constructor(http: HttpClient, @Inject("BASE_URL") baseUrl: string) {
|
||||
constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
|
||||
http
|
||||
.get<WeatherForecast[]>(baseUrl + "api/SampleData/WeatherForecasts")
|
||||
.get<WeatherForecast[]>(baseUrl + 'api/SampleData/WeatherForecasts')
|
||||
.subscribe(
|
||||
result => {
|
||||
this.forecasts = result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue