Use HttpWithStateTransferModule in Angular template

This commit is contained in:
Steve Sanderson
2017-08-02 10:55:55 +01:00
parent 5f1450c9ba
commit 1287709feb
5 changed files with 14 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import { Component, Inject } from '@angular/core';
import { Http } from '@angular/http';
import { HttpWithStateTransfer } from 'aspnet-angular';
@Component({
selector: 'fetchdata',
@@ -8,7 +8,7 @@ import { Http } from '@angular/http';
export class FetchDataComponent {
public forecasts: WeatherForecast[];
constructor(http: Http, @Inject('BASE_URL') baseUrl: string) {
constructor(http: HttpWithStateTransfer, @Inject('BASE_URL') baseUrl: string) {
http.get(baseUrl + 'api/SampleData/WeatherForecasts').subscribe(result => {
this.forecasts = result.json() as WeatherForecast[];
}, error => console.error(error));