How to use the angular2-universal.NODE_ROUTER_PROVIDERS function in angular2-universal

To help you get started, we’ve selected a few angular2-universal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dotnet / aspnetcore / samples / angular / MusicStore / wwwroot / ng-app / boot-server.ts View on Github external
export default function (params: any): Promise<{ html: string, globals?: any }> {
    const serverBindings = [
        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
    ];
    
    return ngUniversal.bootloader({
        directives: [App],
        providers: serverBindings,
        async: true,
        preboot: false,
        // TODO: Render just the  component instead of wrapping it inside an extra HTML document
        // Waiting on https://github.com/angular/universal/issues/347
        template: '\n'
    }).serializeApplication().then(html => {
        return { html };
    });
}
github barbatus / angular2-meteor-universal / build / bootloader.js View on Github external
Bootloader.prototype.getAppProviders = function (options) {
        return angular2_universal_1.NODE_PLATFORM_PIPES.concat(angular2_universal_1.NODE_HTTP_PROVIDERS, angular2_meteor_1.METEOR_PROVIDERS, angular2_universal_1.NODE_ROUTER_PROVIDERS, angular2_universal_1.NODE_LOCATION_PROVIDERS, [
            core_1.provide(angular2_universal_1.ORIGIN_URL, { useValue: global.process.env.ROOT_URL }),
            core_1.provide(angular2_universal_1.BASE_URL, { useValue: router_1.Router.baseUrl }),
            core_1.provide(compiler_1.XHR, {
                useFactory: function (ngZone) {
                    return new meteor_xhr_impl_1.MeteorXHRImpl(ngZone);
                },
                deps: [core_1.NgZone]
            }),
            core_1.provide(logger_1.Logger, { useValue: new logger_1.Logger(router_1.Router.pathDef, options.debug) }),
            core_1.provide(angular2_universal_1.REQUEST_URL, { useValue: router_1.Router.reqUrl })
        ]);
    };
    Bootloader.prototype.bootstrap = function (component, providers, options) {