Update to Angular 4 (but leave directory name as Angular2Spa until finished)

This commit is contained in:
Steve Sanderson
2017-05-17 10:13:46 +01:00
parent b5636ea871
commit 5ade33b870
9 changed files with 132 additions and 106 deletions

View File

@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, Inject } from '@angular/core';
import { Http } from '@angular/http';
@Component({
@@ -8,8 +8,8 @@ import { Http } from '@angular/http';
export class FetchDataComponent {
public forecasts: WeatherForecast[];
constructor(http: Http) {
http.get('/api/SampleData/WeatherForecasts').subscribe(result => {
constructor(http: Http, @Inject('ORIGIN_URL') originUrl: string) {
http.get(originUrl + '/api/SampleData/WeatherForecasts').subscribe(result => {
this.forecasts = result.json() as WeatherForecast[];
});
}