当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript angular2-universal.provide函数代码示例

本文整理汇总了TypeScript中angular2-universal.provide函数的典型用法代码示例。如果您正苦于以下问题:TypeScript provide函数的具体用法?TypeScript provide怎么用?TypeScript provide使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了provide函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: ngApp

function ngApp(req, res) {
  let baseUrl = '/';
  let url = req.originalUrl || '/';

  let config: ExpressEngineConfig = {
    // directives: [ Noop ],
    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,
      ...NODE_STORE_PROVIDERS
    ],
    async: true,
    preboot: true
  };

  res.render('index', config);
}
开发者ID:Erbolking,项目名称:ng-conf-2016-universal-patterns,代码行数:23,代码来源:server.ts

示例2: ngApp

function ngApp(req: express.Request, res) {
  let baseUrl = '/';
  let url = req.originalUrl || '/';
  res.render('index', {
    directives: [ App, HtmlHead, ServerOnlyApp],
    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,
    // preboot: {
    //   appRoot: 'app',
    //   uglify: false,
    //   debug: true
    // }
  });
}
开发者ID:Quramy,项目名称:universal-starter,代码行数:23,代码来源:server.ts

示例3: ngApp

function ngApp(req: any, res: any) {
    let baseUrl = '/';
    let url = req.originalUrl || '/';

    let config: ExpressEngineConfig = {
        directives: [App],

        platformProviders: [
            provide(ORIGIN_URL, { useValue: `http://localhost:${port}` }),
            provide(BASE_URL, { useValue: baseUrl }),
        ],
        providers: [
            provide(REQUEST_URL, { useValue: url }),
            NODE_ROUTER_PROVIDERS,
            NODE_HTTP_PROVIDERS,
        ],
        async: true,
        preboot: { appRoot: 'app' }
    };

    console.log('render index');

    res.render('index', config);
}
开发者ID:SimplyComplexCo,项目名称:material-universal-test,代码行数:24,代码来源:index.ts

示例4: express

    NODE_HTTP_PROVIDERS
} from 'angular2-universal';

let app = express();

import {AppComponent} from '../app/app.component';

app.engine('.html', expressEngine);
app.set('views', __dirname);
app.set('view engine', 'html');

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

// Serve static files
app.use(express.static('.'));

app.use('/', function(req, res){
开发者ID:samlam,项目名称:helloNg2,代码行数:31,代码来源:server.ts

示例5: provide

import { disableDeprecatedForms, provideForms } from '@angular/forms';
import {
  // NODE_HTTP_PROVIDERS,
  // NODE_ROUTER_PROVIDERS
  provide
} from 'angular2-universal';

export const APPLICATION_PROVIDERS = [
  // ...NODE_HTTP_PROVIDERS,
  // ...NODE_ROUTER_PROVIDERS,
  provide(Window, { useValue: {} }),
  disableDeprecatedForms(),
  provideForms()
];

export const PROVIDERS = [
  ...APPLICATION_PROVIDERS
];
开发者ID:narr,项目名称:narr,代码行数:18,代码来源:providers.ts

示例6: Bootloader

  provide,
  enableProdMode,
  expressEngine,
  REQUEST_URL,
  ORIGIN_URL,
  BASE_URL,
  NODE_ROUTER_PROVIDERS,
  NODE_HTTP_PROVIDERS,
  Bootloader
} from 'angular2-universal';

import { App } from '../app';

const bootloader = new Bootloader({
  platformProviders: [
    provide(ORIGIN_URL, { useValue: 'http://localhost:3000' }),
    provide(BASE_URL, { useValue: '/' })
  ],
  async: true,
  preboot: false
});

export function ngApp(req, res) {
  const url = req.originalUrl || '/';

  const APP_CONFIG = {
    template: `
    <!doctype html>
    <html>
      <head>
        <meta charset="utf-8">
开发者ID:drejohnson,项目名称:universal-angular2-starter,代码行数:31,代码来源:app.ts


注:本文中的angular2-universal.provide函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。