當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。