Update to latest Angular2/angular-universal and use relative URLs in template's HTTP request

This commit is contained in:
SteveSandersonMS
2016-04-21 11:36:27 +01:00
parent 6a325f8cc4
commit a0c47252ca
5 changed files with 17 additions and 15 deletions

View File

@@ -12,10 +12,8 @@ export class FetchData {
// Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
let isServerSide = typeof window === 'undefined';
let options: any = isServerSide ? { headers: { Connection: 'keep-alive' } } : null;
// TODO: Switch to relative URL once angular-universal supports them
// https://github.com/angular/universal/issues/348
http.get('http://localhost:5000/api/SampleData/WeatherForecasts', options).subscribe(result => {
http.get('/api/SampleData/WeatherForecasts', options).subscribe(result => {
this.forecasts = result.json();
});
}