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


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

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


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

示例1: platformUniversalDynamic

 compiler.plugin('emit', (_compilation, _callback) => {
   this.platformRef = this.platformRef || platformUniversalDynamic();
   this._options.document = this._options.document || _compilation.assets[this._options.documentPath].source();
   const zone = Zone.current.fork({
     name: 'UNIVERSAL prerender',
     properties: this._options
   });
   zone.run(() => (this.platformRef.serializeModule(this._options.ngModule, this._options))
     .then((html) => {
       if (typeof html !== 'string' || this._options.cancel) {
         _compilation.assets[this._options.documentPath] = {
           source: () => this._options.document,
           size: () => this._options.document.length
         };
         return _callback();
       }
       _compilation.assets[this._options.documentPath] = {
         source: () => html,
         size: () => html.length
       };
       return _callback();
     })); // zone.run
 }); // compiler.plugin
开发者ID:manekinekko,项目名称:universal,代码行数:23,代码来源:prerender.ts

示例2: platformUniversalDynamic

 platform: (providers) => platformUniversalDynamic(providers),
开发者ID:jeckhart,项目名称:universal,代码行数:1,代码来源:index.ts

示例3: enableProdMode

/**
 * the polyfills must be the first thing imported
 */
import './polyfills.ts';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
import { platformUniversalDynamic } from 'angular2-universal';
import { AppModule } from './app/app.browser.module';

/**
 * enable prod mode for production environments
 */
if (environment.production) {
  enableProdMode();
}

const platformRef = platformUniversalDynamic();

/**
 * bootstrap Angular 2 on document ready
 */
document.addEventListener('DOMContentLoaded', () => {
  platformRef.bootstrapModule(AppModule);
});
开发者ID:Codenator81,项目名称:ng2do-mean-app,代码行数:24,代码来源:client.ts

示例4: enableProdMode

import './polyfills.browser.aot';
import './rxjs.imports';

import { enableProdMode } from '@angular/core';
import { platformUniversalDynamic } from 'angular2-universal';
import { AppModuleNgFactory } from '../compiled/src/app/app.module.universal.browser.ngfactory';

if ('production' === ENV) {
  enableProdMode();
}

export const platform = platformUniversalDynamic();

export function main() {
  return platform.bootstrapModuleFactory(AppModuleNgFactory)
    .catch(err => console.log(err));
}

export function bootstrapDomReady() {
  document.addEventListener('DOMContentLoaded', main);
}

bootstrapDomReady();
开发者ID:Ecafracs,项目名称:flatthirteen,代码行数:23,代码来源:main.browser.universal.aot.ts

示例5: main

export function main(): Promise<any> {
  return platformUniversalDynamic()
    .bootstrapModule(AppModule)
    .then(decorateModuleRef)
    .catch(err => console.error(err));
}
开发者ID:asgerjensen,项目名称:angular2-webpack-starter,代码行数:6,代码来源:main.client.ts

示例6: main

export function main() {
  return platformUniversalDynamic().bootstrapModule(AppModule)
    .catch(err => console.log(err));
}
开发者ID:Ecafracs,项目名称:flatthirteen,代码行数:4,代码来源:main.browser.universal.ts


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