mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-24 02:30:13 +00:00
Update Angular2Spa and ReactReduxSpa to use aspnet-prerendering 2.0.0
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'angular2-universal-polyfills';
|
||||
import 'zone.js';
|
||||
import { createServerRenderer, RenderResult } from 'aspnet-prerendering';
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformNodeDynamic } from 'angular2-universal';
|
||||
import { AppModule } from './app/app.module';
|
||||
@@ -7,8 +8,8 @@ import { AppModule } from './app/app.module';
|
||||
enableProdMode();
|
||||
const platform = platformNodeDynamic();
|
||||
|
||||
export default function (params: any) : Promise<{ html: string, globals?: any }> {
|
||||
return new Promise((resolve, reject) => {
|
||||
export default createServerRenderer(params => {
|
||||
return new Promise<RenderResult>((resolve, reject) => {
|
||||
const requestZone = Zone.current.fork({
|
||||
name: 'angular-universal request',
|
||||
properties: {
|
||||
@@ -29,4 +30,4 @@ export default function (params: any) : Promise<{ html: string, globals?: any }>
|
||||
resolve({ html: html });
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"angular2-template-loader": "^0.6.0",
|
||||
"angular2-universal": "~2.0.11",
|
||||
"angular2-universal-polyfills": "~2.0.11",
|
||||
"aspnet-prerendering": "^1.0.7",
|
||||
"aspnet-prerendering": "^2.0.0",
|
||||
"aspnet-webpack": "^1.0.17",
|
||||
"bootstrap": "^3.3.7",
|
||||
"css": "^2.2.1",
|
||||
|
||||
Reference in New Issue
Block a user