File tree Expand file tree Collapse file tree 11 files changed +52
-19
lines changed
samples/angular/MusicStore
src/Microsoft.AspNet.AngularServices/npm Expand file tree Collapse file tree 11 files changed +52
-19
lines changed Original file line number Diff line number Diff line change 22 "name" : " MusicStore" ,
33 "version" : " 0.0.0" ,
44 "dependencies" : {
5- "angular2" : " 2.0.0-beta.13 " ,
6- "angular2-aspnet" : " ^0.0.5 " ,
7- "angular2-universal" : " 0.90 .1" ,
8- "aspnet-prerendering" : " ^1.0.0 " ,
5+ "angular2" : " 2.0.0-beta.15 " ,
6+ "angular2-aspnet" : " ^0.0.6 " ,
7+ "angular2-universal" : " 0.98 .1" ,
8+ "aspnet-prerendering" : " ^1.0.1 " ,
99 "bootstrap" : " ^3.3.5" ,
1010 "css" : " ^2.2.1" ,
1111 "es6-module-loader" : " 0.15.0" ,
Original file line number Diff line number Diff line change @@ -3,13 +3,14 @@ import { FormBuilder } from 'angular2/common';
33import * as ngCore from 'angular2/core' ;
44import * as ngRouter from 'angular2/router' ;
55import * as ngUniversal from 'angular2-universal' ;
6+ import { BASE_URL , ORIGIN_URL , REQUEST_URL } from 'angular2-universal/common' ;
67import { App } from './components/app/app' ;
78
89export default function ( params : any ) : Promise < { html : string , globals ?: any } > {
910 const serverBindings = [
10- ngCore . provide ( ngUniversal . BASE_URL , { useValue : params . absoluteUrl } ) ,
11- ngCore . provide ( ngUniversal . REQUEST_URL , { useValue : params . url } ) ,
12- ngCore . provide ( ngRouter . APP_BASE_HREF , { useValue : '/' } ) ,
11+ ngCore . provide ( BASE_URL , { useValue : '/' } ) ,
12+ ngCore . provide ( ORIGIN_URL , { useValue : params . origin } ) ,
13+ ngCore . provide ( REQUEST_URL , { useValue : params . url } ) ,
1314 ngUniversal . NODE_HTTP_PROVIDERS ,
1415 ngUniversal . NODE_ROUTER_PROVIDERS ,
1516 FormBuilder
Original file line number Diff line number Diff line change @@ -13,7 +13,11 @@ export class AlbumDetails {
1313 public albumData : models . Album ;
1414
1515 constructor ( http : Http , routeParam : router . RouteParams ) {
16- http . get ( '/api/albums/' + routeParam . params [ 'albumId' ] ) . subscribe ( result => {
16+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
17+ let isServerSide = typeof window === 'undefined' ;
18+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
19+
20+ http . get ( '/api/albums/' + routeParam . params [ 'albumId' ] , options ) . subscribe ( result => {
1721 this . albumData = result . json ( ) ;
1822 } ) ;
1923 }
Original file line number Diff line number Diff line change @@ -24,10 +24,14 @@ export class AlbumEdit {
2424 private _http : Http ;
2525
2626 constructor ( fb : FormBuilder , http : Http , routeParam : router . RouteParams ) {
27+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
28+ let isServerSide = typeof window === 'undefined' ;
29+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
30+
2731 this . _http = http ;
2832
2933 var albumId = parseInt ( routeParam . params [ 'albumId' ] ) ;
30- http . get ( '/api/albums/' + albumId ) . subscribe ( result => {
34+ http . get ( '/api/albums/' + albumId , options ) . subscribe ( result => {
3135 var json = result . json ( ) ;
3236 this . originalAlbum = json ;
3337 ( < Control > this . form . controls [ 'Title' ] ) . updateValue ( json . Title ) ;
@@ -37,11 +41,11 @@ export class AlbumEdit {
3741 ( < Control > this . form . controls [ 'AlbumArtUrl' ] ) . updateValue ( json . AlbumArtUrl ) ;
3842 } ) ;
3943
40- http . get ( '/api/artists/lookup' ) . subscribe ( result => {
44+ http . get ( '/api/artists/lookup' , options ) . subscribe ( result => {
4145 this . artists = result . json ( ) ;
4246 } ) ;
4347
44- http . get ( '/api/genres/genre-lookup' ) . subscribe ( result => {
48+ http . get ( '/api/genres/genre-lookup' , options ) . subscribe ( result => {
4549 this . genres = result . json ( ) ;
4650 } ) ;
4751
Original file line number Diff line number Diff line change @@ -45,8 +45,12 @@ export class AlbumsList {
4545 }
4646
4747 refreshData ( ) {
48+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
49+ let isServerSide = typeof window === 'undefined' ;
50+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
51+
4852 var sortBy = this . _sortBy + ( this . _sortByDesc ? ' DESC' : '' ) ;
49- this . _http . get ( `/api/albums?page=${ this . _pageIndex } &pageSize=50&sortBy=${ sortBy } ` ) . subscribe ( result => {
53+ this . _http . get ( `/api/albums?page=${ this . _pageIndex } &pageSize=50&sortBy=${ sortBy } ` , options ) . subscribe ( result => {
5054 var json = result . json ( ) ;
5155 this . rows = json . Data ;
5256
Original file line number Diff line number Diff line change @@ -25,7 +25,11 @@ export class App {
2525 public genres : models . Genre [ ] ;
2626
2727 constructor ( http : Http ) {
28- http . get ( '/api/genres/menu' ) . subscribe ( result => {
28+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
29+ let isServerSide = typeof window === 'undefined' ;
30+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
31+
32+ http . get ( '/api/genres/menu' , options ) . subscribe ( result => {
2933 this . genres = result . json ( ) ;
3034 } ) ;
3135 }
Original file line number Diff line number Diff line change @@ -11,7 +11,11 @@ export class AlbumDetails {
1111 public albumData : models . Album ;
1212
1313 constructor ( http : Http , routeParam : router . RouteParams ) {
14- http . get ( '/api/albums/' + routeParam . params [ 'albumId' ] ) . subscribe ( result => {
14+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
15+ let isServerSide = typeof window === 'undefined' ;
16+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
17+
18+ http . get ( '/api/albums/' + routeParam . params [ 'albumId' ] , options ) . subscribe ( result => {
1519 this . albumData = result . json ( ) ;
1620 } ) ;
1721 }
Original file line number Diff line number Diff line change @@ -13,7 +13,11 @@ export class GenreContents {
1313 public albums : models . Album [ ] ;
1414
1515 constructor ( http : Http , routeParam : router . RouteParams ) {
16- http . get ( `/api/genres/${ routeParam . params [ 'genreId' ] } /albums` ) . subscribe ( result => {
16+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
17+ let isServerSide = typeof window === 'undefined' ;
18+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
19+
20+ http . get ( `/api/genres/${ routeParam . params [ 'genreId' ] } /albums` , options ) . subscribe ( result => {
1721 this . albums = result . json ( ) ;
1822 } ) ;
1923 }
Original file line number Diff line number Diff line change @@ -12,7 +12,11 @@ export class GenresList {
1212 public genres : models . Genre [ ] ;
1313
1414 constructor ( http : Http ) {
15- http . get ( '/api/genres' ) . subscribe ( result => {
15+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
16+ let isServerSide = typeof window === 'undefined' ;
17+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
18+
19+ http . get ( '/api/genres' , options ) . subscribe ( result => {
1620 this . genres = result . json ( ) ;
1721 } ) ;
1822 }
Original file line number Diff line number Diff line change @@ -12,7 +12,11 @@ export class Home {
1212 public mostPopular : models . Album [ ] ;
1313
1414 constructor ( http : Http ) {
15- http . get ( '/api/albums/mostPopular' ) . subscribe ( result => {
15+ // Workaround for RC1 bug. This can be removed with ASP.NET Core 1.0 RC2.
16+ let isServerSide = typeof window === 'undefined' ;
17+ let options : any = isServerSide ? { headers : { Connection : 'keep-alive' } } : null ;
18+
19+ http . get ( '/api/albums/mostPopular' , options ) . subscribe ( result => {
1620 this . mostPopular = result . json ( ) ;
1721 } ) ;
1822 }
You can’t perform that action at this time.
0 commit comments