mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Update Angular 2 Music Store sample to latest Angular2/angular-universal and make HTTP requests work during server-side prerendering
This commit is contained in:
@@ -3,13 +3,14 @@ import { FormBuilder } from 'angular2/common';
|
||||
import * as ngCore from 'angular2/core';
|
||||
import * as ngRouter from 'angular2/router';
|
||||
import * as ngUniversal from 'angular2-universal';
|
||||
import { BASE_URL, ORIGIN_URL, REQUEST_URL } from 'angular2-universal/common';
|
||||
import { App } from './components/app/app';
|
||||
|
||||
export default function (params: any): Promise<{ html: string, globals?: any }> {
|
||||
const serverBindings = [
|
||||
ngCore.provide(ngUniversal.BASE_URL, { useValue: params.absoluteUrl }),
|
||||
ngCore.provide(ngUniversal.REQUEST_URL, { useValue: params.url }),
|
||||
ngCore.provide(ngRouter.APP_BASE_HREF, { useValue: '/' }),
|
||||
ngCore.provide(BASE_URL, { useValue: '/' }),
|
||||
ngCore.provide(ORIGIN_URL, { useValue: params.origin }),
|
||||
ngCore.provide(REQUEST_URL, { useValue: params.url }),
|
||||
ngUniversal.NODE_HTTP_PROVIDERS,
|
||||
ngUniversal.NODE_ROUTER_PROVIDERS,
|
||||
FormBuilder
|
||||
|
||||
Reference in New Issue
Block a user