|
1 |
| -import 'angular2-universal-preview/dist/server/universal-polyfill.js'; |
| 1 | +import 'angular2-universal-polyfills'; |
2 | 2 | import * as ngCore from 'angular2/core';
|
3 | 3 | import * as ngRouter from 'angular2/router';
|
4 | 4 | import * as ngUniversal from 'angular2-universal-preview';
|
5 |
| -import { BASE_URL } from 'angular2-universal-preview/dist/server/src/http/node_http'; |
6 |
| -import * as ngUniversalRender from 'angular2-universal-preview/dist/server/src/render'; |
7 | 5 | import { App } from './components/app/app';
|
8 | 6 |
|
9 | 7 | export default function (params: any): Promise<{ html: string, globals?: any }> {
|
10 | 8 | const serverBindings = [
|
11 | 9 | ngRouter.ROUTER_BINDINGS,
|
12 | 10 | ngUniversal.HTTP_PROVIDERS,
|
13 |
| - ngUniversal.SERVER_LOCATION_PROVIDERS, |
| 11 | + ngUniversal.NODE_LOCATION_PROVIDERS, |
14 | 12 | ngCore.provide(ngRouter.APP_BASE_HREF, { useValue: '/' }),
|
15 |
| - ngCore.provide(BASE_URL, { useValue: params.absoluteUrl }), |
| 13 | + ngCore.provide(ngUniversal.BASE_URL, { useValue: params.absoluteUrl }), |
16 | 14 | ngCore.provide(ngUniversal.REQUEST_URL, { useValue: params.url })
|
17 | 15 | ];
|
18 | 16 |
|
19 |
| - return ngUniversalRender.renderToString(App, serverBindings).then(html => { |
| 17 | + return ngUniversal.renderDocument('<app />', App, serverBindings).then(html => { |
20 | 18 | return { html };
|
21 | 19 | });
|
22 | 20 | }
|
0 commit comments