Update fetch-data.component.ts

This commit is contained in:
Isaac Levin 2019-06-07 11:34:23 -04:00 committed by GitHub
parent 50833cc8f9
commit dc3d1815cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -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;