diff --git a/Microsoft.AspNet.AngularServices/Content/Node/angular-rendering.js b/Microsoft.AspNet.AngularServices/Content/Node/angular-rendering.js index e9d5a29..db75eb3 100644 --- a/Microsoft.AspNet.AngularServices/Content/Node/angular-rendering.js +++ b/Microsoft.AspNet.AngularServices/Content/Node/angular-rendering.js @@ -1,6 +1,7 @@ var path = require('path'); -var ngUniversal = require('angular2-universal-patched'); -var ng = require('angular2/angular2'); +var ngUniversal = require('angular2-universal-preview'); +var ngUniversalRender = require('angular2-universal-preview/dist/server/src/render'); +var ngCore = require('angular2/core'); var ngRouter = require('angular2/router'); function getExportOrThrow(moduleInstance, moduleFilename, exportName) { @@ -36,11 +37,12 @@ module.exports = { var serverBindings = [ ngRouter.ROUTER_BINDINGS, ngUniversal.HTTP_PROVIDERS, - ng.provide(ngUniversal.BASE_URL, { useValue: options.requestUrl }), + ngCore.provide(ngUniversal.BASE_URL, { useValue: options.requestUrl }), + ngCore.provide(ngRouter.APP_BASE_HREF, { useValue: '/' }), ngUniversal.SERVER_LOCATION_PROVIDERS ]; - return ngUniversal.renderToString(component, serverBindings).then( + return ngUniversalRender.renderToString(component, serverBindings).then( function(successValue) { callback(null, successValue); }, function(errorValue) { callback(errorValue); } ); diff --git a/Microsoft.AspNet.AngularServices/npm/build.js b/Microsoft.AspNet.AngularServices/npm/build.js index f8fd313..937708a 100644 --- a/Microsoft.AspNet.AngularServices/npm/build.js +++ b/Microsoft.AspNet.AngularServices/npm/build.js @@ -13,7 +13,7 @@ builder.config({ }, meta: { 'angular2/*': { build: false }, - '@reactivex/*': { build: false } + 'rxjs/*': { build: false } } }); diff --git a/Microsoft.AspNet.AngularServices/npm/package.json b/Microsoft.AspNet.AngularServices/npm/package.json index ec35af7..2262070 100644 --- a/Microsoft.AspNet.AngularServices/npm/package.json +++ b/Microsoft.AspNet.AngularServices/npm/package.json @@ -15,7 +15,8 @@ "author": "Microsoft", "license": "Apache-2.0", "peerDependencies": { - "angular2": "2.0.0-alpha.44" + "angular2": "2.0.0-beta.1", + "rxjs": "5.0.0-beta.0" }, "devDependencies": { "systemjs-builder": "^0.14.11", diff --git a/Microsoft.AspNet.AngularServices/npm/src/CachePrimedHttp.ts b/Microsoft.AspNet.AngularServices/npm/src/CachePrimedHttp.ts index e72f962..991dd24 100644 --- a/Microsoft.AspNet.AngularServices/npm/src/CachePrimedHttp.ts +++ b/Microsoft.AspNet.AngularServices/npm/src/CachePrimedHttp.ts @@ -1,5 +1,5 @@ import { provide, Injectable, Provider } from 'angular2/core'; -import { Connection, ConnectionBackend, Http, XHRBackend, RequestOptions, Request, RequestMethods, Response, ResponseOptions, ReadyStates } from 'angular2/http'; +import { Connection, ConnectionBackend, Http, XHRBackend, RequestOptions, Request, RequestMethod, Response, ResponseOptions, ReadyState } from 'angular2/http'; @Injectable() export class CachePrimedConnectionBackend extends ConnectionBackend { @@ -12,7 +12,7 @@ export class CachePrimedConnectionBackend extends ConnectionBackend { public createConnection(request: Request): Connection { let cacheKey = request.url; - if (request.method === RequestMethods.Get && this._preCachedResponses.hasOwnProperty(cacheKey)) { + if (request.method === RequestMethod.Get && this._preCachedResponses.hasOwnProperty(cacheKey)) { return new CacheHitConnection(request, this._preCachedResponses[cacheKey], this._baseResponseOptions); } else { return this._underlyingBackend.createConnection(request); @@ -21,21 +21,17 @@ export class CachePrimedConnectionBackend extends ConnectionBackend { } class CacheHitConnection implements Connection { - readyState: ReadyStates; + readyState: ReadyState; request: Request; response: any; constructor (req: Request, cachedResponse: PreCachedResponse, baseResponseOptions: ResponseOptions) { this.request = req; - this.readyState = ReadyStates.Done; + this.readyState = ReadyState.Done; // Workaround for difficulty consuming CommonJS default exports in TypeScript. Note that it has to be a dynamic // 'require', and not an 'import' statement, because the module isn't available on the server. - // All this badness goes away with the next update of Angular 2, as it exposes Observable directly from angular2/core. - // -- - // The current version of Angular exposes the following SystemJS module directly (it is *not* coming from the - // @reactivex/rxjs NPM package - it's coming from angular2). - let obsCtor: any = require('@reactivex/rxjs/dist/cjs/Observable'); + let obsCtor: any = require('rxjs/Observable').Observable; this.response = new obsCtor(responseObserver => { let response = new Response(new ResponseOptions({ body: cachedResponse.body, status: cachedResponse.statusCode })); responseObserver.next(response); diff --git a/Microsoft.AspNet.AngularServices/npm/src/Validation.ts b/Microsoft.AspNet.AngularServices/npm/src/Validation.ts index b6d7535..0745228 100644 --- a/Microsoft.AspNet.AngularServices/npm/src/Validation.ts +++ b/Microsoft.AspNet.AngularServices/npm/src/Validation.ts @@ -1,4 +1,4 @@ -import { ControlGroup } from 'angular2/angular2'; +import { ControlGroup } from 'angular2/common'; import { Response } from 'angular2/http'; export class Validation { diff --git a/samples/angular/MusicStore/Views/Home/Index.cshtml b/samples/angular/MusicStore/Views/Home/Index.cshtml index 03074c6..a5d33b4 100755 --- a/samples/angular/MusicStore/Views/Home/Index.cshtml +++ b/samples/angular/MusicStore/Views/Home/Index.cshtml @@ -12,11 +12,12 @@ @await Html.PrimeCache(Url.Action("GenreMenuList", "GenresApi")) @await Html.PrimeCache(Url.Action("MostPopular", "AlbumsApi")) + - + diff --git a/samples/angular/MusicStore/gulpfile.js b/samples/angular/MusicStore/gulpfile.js index 3719ede..e244fc5 100755 --- a/samples/angular/MusicStore/gulpfile.js +++ b/samples/angular/MusicStore/gulpfile.js @@ -17,16 +17,17 @@ var config = { lib: [ require.resolve('bootstrap/dist/css/bootstrap.css'), path.dirname(require.resolve('bootstrap/dist/fonts/glyphicons-halflings-regular.woff')) + '/**', + require.resolve('angular2/bundles/angular2-polyfills.js'), require.resolve('traceur/bin/traceur-runtime.js'), require.resolve('es6-module-loader/dist/es6-module-loader-sans-promises.js'), - require.resolve('reflect-metadata/Reflect.js'), require.resolve('systemjs/dist/system.src.js'), require.resolve('angular2/bundles/angular2.dev.js'), require.resolve('angular2/bundles/router.dev.js'), require.resolve('angular2/bundles/http.dev.js'), require.resolve('angular2-aspnet/bundles/angular2-aspnet.js'), require.resolve('jquery/dist/jquery.js'), - require.resolve('bootstrap/dist/js/bootstrap.js') + require.resolve('bootstrap/dist/js/bootstrap.js'), + require.resolve('rxjs/bundles/Rx.js') ] }; diff --git a/samples/angular/MusicStore/package.json b/samples/angular/MusicStore/package.json index c399ffa..6bc646f 100644 --- a/samples/angular/MusicStore/package.json +++ b/samples/angular/MusicStore/package.json @@ -2,15 +2,16 @@ "name": "MusicStore", "version": "0.0.0", "dependencies": { - "angular2": "2.0.0-alpha.44", + "angular2": "2.0.0-beta.1", "angular2-aspnet": "^0.0.3", - "angular2-universal-patched": "^0.5.4", + "angular2-universal-preview": "^0.32.2", "bootstrap": "^3.3.5", "es6-module-loader": "^0.15.0", "jquery": "^2.1.4", "less": "^2.5.3", "lodash": "^3.10.1", "reflect-metadata": "^0.1.2", + "rxjs": "^5.0.0-beta.0", "systemjs": "^0.19.3", "traceur": "0.0.91" }, diff --git a/samples/angular/MusicStore/wwwroot/ng-app/components/admin/admin-home/admin-home.ts b/samples/angular/MusicStore/wwwroot/ng-app/components/admin/admin-home/admin-home.ts index 73eeafc..8bcb893 100644 --- a/samples/angular/MusicStore/wwwroot/ng-app/components/admin/admin-home/admin-home.ts +++ b/samples/angular/MusicStore/wwwroot/ng-app/components/admin/admin-home/admin-home.ts @@ -1,4 +1,4 @@ -import * as ng from 'angular2/angular2'; +import * as ng from 'angular2/core'; import * as router from 'angular2/router'; import { AlbumsList } from '../albums-list/albums-list'; import { AlbumDetails } from '../album-details/album-details'; @@ -8,9 +8,9 @@ import { AlbumEdit } from '../album-edit/album-edit'; selector: 'admin-home' }) @router.RouteConfig([ - { path: 'albums', as: 'Albums', component: AlbumsList }, - { path: 'album/details/:albumId', as: 'AlbumDetails', component: AlbumDetails }, - { path: 'album/edit/:albumId', as: 'AlbumEdit', component: AlbumEdit } + { path: 'albums', name: 'Albums', component: AlbumsList }, + { path: 'album/details/:albumId', name: 'AlbumDetails', component: AlbumDetails }, + { path: 'album/edit/:albumId', name: 'AlbumEdit', component: AlbumEdit } ]) @ng.View({ templateUrl: './ng-app/components/admin/admin-home/admin-home.html', diff --git a/samples/angular/MusicStore/wwwroot/ng-app/components/admin/album-delete-prompt/album-delete-prompt.html b/samples/angular/MusicStore/wwwroot/ng-app/components/admin/album-delete-prompt/album-delete-prompt.html index a04250c..2f6b0ba 100644 --- a/samples/angular/MusicStore/wwwroot/ng-app/components/admin/album-delete-prompt/album-delete-prompt.html +++ b/samples/angular/MusicStore/wwwroot/ng-app/components/admin/album-delete-prompt/album-delete-prompt.html @@ -1,5 +1,5 @@