How to use the angular2-universal.provide 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 angular / universal-starter / src / server.ts View on Github external
function ngApp(req, res) {
  let baseUrl = '/';
  let url = req.originalUrl || '/';

  let config: ExpressEngineConfig = {
    directives: [ App ],
    platformProviders: [
      provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
      provide(BASE_URL, {useValue: baseUrl}),
    ],
    providers: [
      provide(REQUEST_URL, {useValue: url}),
      NODE_ROUTER_PROVIDERS,
      NODE_HTTP_PROVIDERS,
    ],
    async: true,
    preboot: false // { appRoot: 'app' } // your top level app component selector
  };

  res.render('index', config);
}
github bennylut / hello-angular2-universal-j2v8 / src / main / angular2 / server.ts View on Github external
JavaEngine.connect((reqInfo:IExampleRequestInfo) => {
    let baseUrl = '/';

    let url = reqInfo.url;

    let config:BootloaderConfig = {
        directives: [App],
        platformProviders: [
            provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
            provide(BASE_URL, {useValue: baseUrl}),
        ],
        providers: [
            provide(REQUEST_URL, {useValue: url}),
            NODE_ROUTER_PROVIDERS,
            NODE_HTTP_PROVIDERS,
        ],
        async: true,
        preboot: false // { appRoot: 'app' } // your top level app component selector
    };

    return config;
});
github bennylut / hello-angular2-universal-j2v8 / src / main / angular2 / server.ts View on Github external
JavaEngine.connect((reqInfo:IExampleRequestInfo) => {
    let baseUrl = '/';

    let url = reqInfo.url;

    let config:BootloaderConfig = {
        directives: [App],
        platformProviders: [
            provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
            provide(BASE_URL, {useValue: baseUrl}),
        ],
        providers: [
            provide(REQUEST_URL, {useValue: url}),
            NODE_ROUTER_PROVIDERS,
            NODE_HTTP_PROVIDERS,
        ],
        async: true,
        preboot: false // { appRoot: 'app' } // your top level app component selector
    };

    return config;
});
github bennylut / hello-angular2-universal-j2v8 / src / main / angular2 / server.ts View on Github external
JavaEngine.connect((reqInfo:IExampleRequestInfo) => {
    let baseUrl = '/';

    let url = reqInfo.url;

    let config:BootloaderConfig = {
        directives: [App],
        platformProviders: [
            provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
            provide(BASE_URL, {useValue: baseUrl}),
        ],
        providers: [
            provide(REQUEST_URL, {useValue: url}),
            NODE_ROUTER_PROVIDERS,
            NODE_HTTP_PROVIDERS,
        ],
        async: true,
        preboot: false // { appRoot: 'app' } // your top level app component selector
    };

    return config;
});
github angular / universal-starter / src / server.ts View on Github external
function ngApp(req, res) {
  let baseUrl = '/';
  let url = req.originalUrl || '/';

  let config: ExpressEngineConfig = {
    directives: [ App ],
    platformProviders: [
      provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
      provide(BASE_URL, {useValue: baseUrl}),
    ],
    providers: [
      provide(REQUEST_URL, {useValue: url}),
      NODE_ROUTER_PROVIDERS,
      NODE_HTTP_PROVIDERS,
    ],
    async: true,
    preboot: false // { appRoot: 'app' } // your top level app component selector
  };

  res.render('index', config);
}
github angular / universal-starter / src / server.ts View on Github external
function ngApp(req, res) {
  let baseUrl = '/';
  let url = req.originalUrl || '/';

  let config: ExpressEngineConfig = {
    directives: [ App ],
    platformProviders: [
      provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
      provide(BASE_URL, {useValue: baseUrl}),
    ],
    providers: [
      provide(REQUEST_URL, {useValue: url}),
      NODE_ROUTER_PROVIDERS,
      NODE_HTTP_PROVIDERS,
    ],
    async: true,
    preboot: false // { appRoot: 'app' } // your top level app component selector
  };

  res.render('index', config);
}
github DSpace-Labs / angular2-ui-prototype / src / server.ts View on Github external
function ngApp(req, res) {
    let baseUrl = '/';
    let url = req.originalUrl || '/';
    res.render('index', {
        directives: [ AppComponent, TitleComponent ],
        platformProviders: [
            provide(ORIGIN_URL, {useValue: GlobalConfig.ui.baseURL}),
            provide(BASE_URL, {useValue: baseUrl}),
        ],
        providers: [
            NODE_ROUTER_PROVIDERS,
            NODE_LOCATION_PROVIDERS,
            NODE_PRELOAD_CACHE_HTTP_PROVIDERS,
            provide(REQUEST_URL, { useValue: url }),
            provide(TranslateLoader, {
                useFactory: (http: Http) => new TranslateStaticLoader(http, 'i18n', '.json'),
                deps: [ Http ]
            }),
            AuthorizationService,
            provide(StorageService, {
                useFactory: () => new TempServerStorageService()
            }),
            BreadcrumbService,
            ContextProviderService,
            DSpaceConstantsService,
            DSpaceHierarchyService,
            DSpaceService,
            FormService,
            GoogleScholarMetadataService,
            HttpService,
github DSpace-Labs / angular2-ui-prototype / src / server.ts View on Github external
directives: [ AppComponent, TitleComponent ],
        platformProviders: [
            provide(ORIGIN_URL, {useValue: GlobalConfig.ui.baseURL}),
            provide(BASE_URL, {useValue: baseUrl}),
        ],
        providers: [
            NODE_ROUTER_PROVIDERS,
            NODE_LOCATION_PROVIDERS,
            NODE_PRELOAD_CACHE_HTTP_PROVIDERS,
            provide(REQUEST_URL, { useValue: url }),
            provide(TranslateLoader, {
                useFactory: (http: Http) => new TranslateStaticLoader(http, 'i18n', '.json'),
                deps: [ Http ]
            }),
            AuthorizationService,
            provide(StorageService, {
                useFactory: () => new TempServerStorageService()
            }),
            BreadcrumbService,
            ContextProviderService,
            DSpaceConstantsService,
            DSpaceHierarchyService,
            DSpaceService,
            FormService,
            GoogleScholarMetadataService,
            HttpService,
            MetadataHelper,
            MetaTagService,
            NotificationService,
            PaginationService,
            PagingStoreService,
            TranslateService,
github DSpace-Labs / angular2-ui-prototype / src / server.ts View on Github external
function ngApp(req, res) {
    let baseUrl = '/';
    let url = req.originalUrl || '/';
    res.render('index', {
        directives: [ AppComponent, TitleComponent ],
        platformProviders: [
            provide(ORIGIN_URL, {useValue: GlobalConfig.ui.baseURL}),
            provide(BASE_URL, {useValue: baseUrl}),
        ],
        providers: [
            NODE_ROUTER_PROVIDERS,
            NODE_LOCATION_PROVIDERS,
            NODE_PRELOAD_CACHE_HTTP_PROVIDERS,
            provide(REQUEST_URL, { useValue: url }),
            provide(TranslateLoader, {
                useFactory: (http: Http) => new TranslateStaticLoader(http, 'i18n', '.json'),
                deps: [ Http ]
            }),
            AuthorizationService,
            provide(StorageService, {
                useFactory: () => new TempServerStorageService()
            }),
            BreadcrumbService,
github DSpace-Labs / angular2-ui-prototype / src / server.ts View on Github external
function ngApp(req, res) {
    let baseUrl = '/';
    let url = req.originalUrl || '/';
    res.render('index', {
        directives: [ AppComponent, TitleComponent ],
        platformProviders: [
            provide(ORIGIN_URL, {useValue: GlobalConfig.ui.baseURL}),
            provide(BASE_URL, {useValue: baseUrl}),
        ],
        providers: [
            NODE_ROUTER_PROVIDERS,
            NODE_LOCATION_PROVIDERS,
            NODE_PRELOAD_CACHE_HTTP_PROVIDERS,
            provide(REQUEST_URL, { useValue: url }),
            provide(TranslateLoader, {
                useFactory: (http: Http) => new TranslateStaticLoader(http, 'i18n', '.json'),
                deps: [ Http ]
            }),
            AuthorizationService,
            provide(StorageService, {
                useFactory: () => new TempServerStorageService()
            }),
            BreadcrumbService,
            ContextProviderService,