File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
templates/Angular2Spa/ClientApp/components/fetch-data Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,13 @@ export class FetchData {
9
9
public forecasts : WeatherForecast [ ] ;
10
10
11
11
constructor ( http : Http ) {
12
+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
13
+ let isServerSide = typeof window === 'undefined' ;
14
+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
15
+
12
16
// TODO: Switch to relative URL once angular-universal supports them
13
17
// https://github.com/angular/universal/issues/348
14
- http . get ( 'http://localhost:5000/api/SampleData/WeatherForecasts' , {
15
- headers : < any > { Connection : 'keep-alive' } // Workaround for RC1 bug. TODO: Remove this after updating to RC2
16
- } ) . subscribe ( result => {
18
+ http . get ( 'http://localhost:5000/api/SampleData/WeatherForecasts' , options ) . subscribe ( result => {
17
19
this . forecasts = result . json ( ) ;
18
20
} ) ;
19
21
}
You can’t perform that action at this time.
0 commit comments