Skip to content

Commit 381b7b8

Browse files
Update to Angular 2 Beta 1. New bug: no longer waits for server-side HTTP requests to complete - waiting for info to resolve this.
1 parent f44b84f commit 381b7b8

File tree

32 files changed

+113
-100
lines changed

32 files changed

+113
-100
lines changed

Microsoft.AspNet.AngularServices/Content/Node/angular-rendering.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var path = require('path');
2-
var ngUniversal = require('angular2-universal-patched');
3-
var ng = require('angular2/angular2');
2+
var ngUniversal = require('angular2-universal-preview');
3+
var ngUniversalRender = require('angular2-universal-preview/dist/server/src/render');
4+
var ngCore = require('angular2/core');
45
var ngRouter = require('angular2/router');
56

67
function getExportOrThrow(moduleInstance, moduleFilename, exportName) {
@@ -36,11 +37,12 @@ module.exports = {
3637
var serverBindings = [
3738
ngRouter.ROUTER_BINDINGS,
3839
ngUniversal.HTTP_PROVIDERS,
39-
ng.provide(ngUniversal.BASE_URL, { useValue: options.requestUrl }),
40+
ngCore.provide(ngUniversal.BASE_URL, { useValue: options.requestUrl }),
41+
ngCore.provide(ngRouter.APP_BASE_HREF, { useValue: '/' }),
4042
ngUniversal.SERVER_LOCATION_PROVIDERS
4143
];
4244

43-
return ngUniversal.renderToString(component, serverBindings).then(
45+
return ngUniversalRender.renderToString(component, serverBindings).then(
4446
function(successValue) { callback(null, successValue); },
4547
function(errorValue) { callback(errorValue); }
4648
);

Microsoft.AspNet.AngularServices/npm/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ builder.config({
1313
},
1414
meta: {
1515
'angular2/*': { build: false },
16-
'@reactivex/*': { build: false }
16+
'rxjs/*': { build: false }
1717
}
1818
});
1919

Microsoft.AspNet.AngularServices/npm/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"author": "Microsoft",
1616
"license": "Apache-2.0",
1717
"peerDependencies": {
18-
"angular2": "2.0.0-alpha.44"
18+
"angular2": "2.0.0-beta.1",
19+
"rxjs": "5.0.0-beta.0"
1920
},
2021
"devDependencies": {
2122
"systemjs-builder": "^0.14.11",

Microsoft.AspNet.AngularServices/npm/src/CachePrimedHttp.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { provide, Injectable, Provider } from 'angular2/core';
2-
import { Connection, ConnectionBackend, Http, XHRBackend, RequestOptions, Request, RequestMethods, Response, ResponseOptions, ReadyStates } from 'angular2/http';
2+
import { Connection, ConnectionBackend, Http, XHRBackend, RequestOptions, Request, RequestMethod, Response, ResponseOptions, ReadyState } from 'angular2/http';
33

44
@Injectable()
55
export class CachePrimedConnectionBackend extends ConnectionBackend {
@@ -12,7 +12,7 @@ export class CachePrimedConnectionBackend extends ConnectionBackend {
1212

1313
public createConnection(request: Request): Connection {
1414
let cacheKey = request.url;
15-
if (request.method === RequestMethods.Get && this._preCachedResponses.hasOwnProperty(cacheKey)) {
15+
if (request.method === RequestMethod.Get && this._preCachedResponses.hasOwnProperty(cacheKey)) {
1616
return new CacheHitConnection(request, this._preCachedResponses[cacheKey], this._baseResponseOptions);
1717
} else {
1818
return this._underlyingBackend.createConnection(request);
@@ -21,21 +21,17 @@ export class CachePrimedConnectionBackend extends ConnectionBackend {
2121
}
2222

2323
class CacheHitConnection implements Connection {
24-
readyState: ReadyStates;
24+
readyState: ReadyState;
2525
request: Request;
2626
response: any;
2727

2828
constructor (req: Request, cachedResponse: PreCachedResponse, baseResponseOptions: ResponseOptions) {
2929
this.request = req;
30-
this.readyState = ReadyStates.Done;
30+
this.readyState = ReadyState.Done;
3131

3232
// Workaround for difficulty consuming CommonJS default exports in TypeScript. Note that it has to be a dynamic
3333
// 'require', and not an 'import' statement, because the module isn't available on the server.
34-
// All this badness goes away with the next update of Angular 2, as it exposes Observable directly from angular2/core.
35-
// --
36-
// The current version of Angular exposes the following SystemJS module directly (it is *not* coming from the
37-
// @reactivex/rxjs NPM package - it's coming from angular2).
38-
let obsCtor: any = require('@reactivex/rxjs/dist/cjs/Observable');
34+
let obsCtor: any = require('rxjs/Observable').Observable;
3935
this.response = new obsCtor(responseObserver => {
4036
let response = new Response(new ResponseOptions({ body: cachedResponse.body, status: cachedResponse.statusCode }));
4137
responseObserver.next(response);

Microsoft.AspNet.AngularServices/npm/src/Validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ControlGroup } from 'angular2/angular2';
1+
import { ControlGroup } from 'angular2/common';
22
import { Response } from 'angular2/http';
33

44
export class Validation {

samples/angular/MusicStore/Views/Home/Index.cshtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
@await Html.PrimeCache(Url.Action("GenreMenuList", "GenresApi"))
1313
@await Html.PrimeCache(Url.Action("MostPopular", "AlbumsApi"))
1414

15+
<script src="~/lib/angular2/bundles/angular2-polyfills.js"></script>
1516
<script src="~/lib/traceur/bin/traceur-runtime.js"></script>
1617
<script src="~/lib/es6-module-loader/dist/es6-module-loader-sans-promises.js"></script>
17-
<script src="~/lib/reflect-metadata/Reflect.js"></script>
1818
<script src="~/lib/systemjs/dist/system.src.js"></script>
1919
<script src="~/system.config.js"></script>
20+
<script src="~/lib/rxjs/bundles/Rx.js"></script>
2021
<script src="~/lib/angular2/bundles/angular2.dev.js"></script>
2122
<script src="~/lib/angular2/bundles/router.dev.js"></script>
2223
<script src="~/lib/angular2/bundles/http.dev.js"></script>

samples/angular/MusicStore/gulpfile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ var config = {
1717
lib: [
1818
require.resolve('bootstrap/dist/css/bootstrap.css'),
1919
path.dirname(require.resolve('bootstrap/dist/fonts/glyphicons-halflings-regular.woff')) + '/**',
20+
require.resolve('angular2/bundles/angular2-polyfills.js'),
2021
require.resolve('traceur/bin/traceur-runtime.js'),
2122
require.resolve('es6-module-loader/dist/es6-module-loader-sans-promises.js'),
22-
require.resolve('reflect-metadata/Reflect.js'),
2323
require.resolve('systemjs/dist/system.src.js'),
2424
require.resolve('angular2/bundles/angular2.dev.js'),
2525
require.resolve('angular2/bundles/router.dev.js'),
2626
require.resolve('angular2/bundles/http.dev.js'),
2727
require.resolve('angular2-aspnet/bundles/angular2-aspnet.js'),
2828
require.resolve('jquery/dist/jquery.js'),
29-
require.resolve('bootstrap/dist/js/bootstrap.js')
29+
require.resolve('bootstrap/dist/js/bootstrap.js'),
30+
require.resolve('rxjs/bundles/Rx.js')
3031
]
3132
};
3233

samples/angular/MusicStore/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
"name": "MusicStore",
33
"version": "0.0.0",
44
"dependencies": {
5-
"angular2": "2.0.0-alpha.44",
5+
"angular2": "2.0.0-beta.1",
66
"angular2-aspnet": "^0.0.3",
7-
"angular2-universal-patched": "^0.5.4",
7+
"angular2-universal-preview": "^0.32.2",
88
"bootstrap": "^3.3.5",
99
"es6-module-loader": "^0.15.0",
1010
"jquery": "^2.1.4",
1111
"less": "^2.5.3",
1212
"lodash": "^3.10.1",
1313
"reflect-metadata": "^0.1.2",
14+
"rxjs": "^5.0.0-beta.0",
1415
"systemjs": "^0.19.3",
1516
"traceur": "0.0.91"
1617
},

samples/angular/MusicStore/wwwroot/ng-app/components/admin/admin-home/admin-home.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as ng from 'angular2/angular2';
1+
import * as ng from 'angular2/core';
22
import * as router from 'angular2/router';
33
import { AlbumsList } from '../albums-list/albums-list';
44
import { AlbumDetails } from '../album-details/album-details';
@@ -8,9 +8,9 @@ import { AlbumEdit } from '../album-edit/album-edit';
88
selector: 'admin-home'
99
})
1010
@router.RouteConfig([
11-
{ path: 'albums', as: 'Albums', component: AlbumsList },
12-
{ path: 'album/details/:albumId', as: 'AlbumDetails', component: AlbumDetails },
13-
{ path: 'album/edit/:albumId', as: 'AlbumEdit', component: AlbumEdit }
11+
{ path: 'albums', name: 'Albums', component: AlbumsList },
12+
{ path: 'album/details/:albumId', name: 'AlbumDetails', component: AlbumDetails },
13+
{ path: 'album/edit/:albumId', name: 'AlbumEdit', component: AlbumEdit }
1414
])
1515
@ng.View({
1616
templateUrl: './ng-app/components/admin/admin-home/admin-home.html',

samples/angular/MusicStore/wwwroot/ng-app/components/admin/album-delete-prompt/album-delete-prompt.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="modal fade">
2-
<div class="modal-dialog" *ng-if="album">
2+
<div class="modal-dialog" *ngIf="album">
33
<div class="modal-content">
44
<div class="modal-header">
55
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

0 commit comments

Comments
 (0)