• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript module-map-ngfactory-loader.provideModuleMap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: renderModuleFactory

 prom = prom.then(_ => renderModuleFactory(AppServerModuleNgFactory, {
   document: index,
   url: route,
   extraProviders: [
     provideModuleMap(LAZY_MODULE_MAP)
   ]
 })).then(html => writeFileSync(join(BROWSER_FOLDER, route, 'index.html'), html));
开发者ID:sebastienbarbier,项目名称:sebastienbarbier.com,代码行数:7,代码来源:prerender.ts


示例2: renderModuleFactory

 previousRender = previousRender.then(_ => renderModuleFactory(AppServerModuleNgFactory, {
   document: index,
   url: route,
   extraProviders: [
     provideModuleMap(LAZY_MODULE_MAP)
   ]
 })).then(html => writeFileSync(join(fullPath, 'index.html'), html));
开发者ID:nacardin,项目名称:monicawulaw-website,代码行数:7,代码来源:prerender.ts


示例3: renderModuleFactory

app.engine('html', (_: any, options: any, callback: any) => {
  renderModuleFactory(AppServerModuleNgFactory, {
    document: template,
    url: options.req.url,
    extraProviders: [
      provideModuleMap(LAZY_MODULE_MAP)
    ]
  }).then(html => {
    callback(null, html);
  });
});
开发者ID:mightymoose,项目名称:mmoaig,代码行数:11,代码来源:server.ts


示例4: renderModuleFactory

app.engine('html', (_, options, callback) => {
  renderModuleFactory(AppServerModuleNgFactory, {
    // Our index.html
    document: template,
    url: options.req.url,
    // DI so that we can get lazy-loading to work differently (since we need it to just instantly render it)
    extraProviders: [provideModuleMap(LAZY_MODULE_MAP)]
  }).then(html => {
    callback(null, html);
  });
});
开发者ID:garlictech,项目名称:generator-garlic-webapp,代码行数:11,代码来源:server.ts


示例5: engine

app.get('**', (req, res) => {
  const url: string = req.path;
  engine(url, {
    req,
    res,
    url,
    document,
    bootstrap: AppServerModuleNgFactory,
    providers: [
      provideModuleMap(LAZY_MODULE_MAP)
    ]
  }, (err?: Error, html: string = 'oops') => {
    res.set('Cache-Control', 'public, max-age=3600, s-maxage=43200');
    res.send((err) ? err.message : html);
  });
});
开发者ID:MichaelSolati,项目名称:ng-portfolio,代码行数:16,代码来源:ssr.ts


示例6: createServerRenderer

export default createServerRenderer(params => {
  const { AppServerModule, AppServerModuleNgFactory, LAZY_MODULE_MAP } = (module as any).exports;
 
  const options = {
    document: params.data.originalHtml,
    url: params.url,
    extraProviders: [
      provideModuleMap(LAZY_MODULE_MAP),
      { provide: APP_BASE_HREF, useValue: params.baseUrl },
      { provide: 'BASE_URL', useValue: params.origin + params.baseUrl }
    ]
  };

  const renderPromise = AppServerModuleNgFactory
    ? /* AoT */ renderModuleFactory(AppServerModuleNgFactory, options)
    : /* dev */ renderModule(AppServerModule, options);
    
  return renderPromise.then(html => ({ html }));
});
开发者ID:jasebanico,项目名称:banico,代码行数:19,代码来源:main.server.ts


示例7: renderModuleFactory

app.engine('html', (_, options, callback) => {
  renderModuleFactory(AppServerModuleNgFactory, {
    // Our index.html
    document: template,
    url: options.req.url,
    
    // configure DI to make lazy-loading work differently
    // (we need to instantly render the view)
    extraProviders: [
      provideModuleMap(LAZY_MODULE_MAP),
      {
          provide: REQUEST,
          useValue: options.req
      },
      {
          provide: RESPONSE,
          useValue: options.req.res,
      },
    ]
  }).then(html => {
    callback(null, html);
  });
});
开发者ID:usnistgov,项目名称:oar-pdr,代码行数:23,代码来源:server.ts


示例8: readFileSync

// Our index.html we'll use as our template
const template = readFileSync(join(DIST_FOLDER, 'browser', 'index.html')).toString();

// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle');

// Express Engine
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';

// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
app.engine('html', ngExpressEngine({
  bootstrap: AppServerModuleNgFactory,
  providers: [
    provideModuleMap(LAZY_MODULE_MAP)
  ]
}));

app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));

/* - Example Express Rest API endpoints -
  app.get('/api/**', (req, res) => { });
*/

// Server static files from /browser
app.get('*.*', express.static(join(DIST_FOLDER, 'browser'), {
  maxAge: '1y'
}));
开发者ID:MarkPieszak,项目名称:universal-starter,代码行数:30,代码来源:server.ts


示例9: require

// Load zone.js for the server.
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import { readFileSync, writeFileSync } from 'fs';
import { join } from 'path';

// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';

import { renderModuleFactory } from '@angular/platform-server';

// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./server/main');

// Load the index.html file containing referances to your application bundle.
const index = readFileSync(join('browser', 'index.html'), 'utf8');

// Writes rendered HTML to ./dist/index.html, replacing the file if it already exists.
renderModuleFactory(AppServerModuleNgFactory, {
  document: index,
  url: '/',
  extraProviders: [provideModuleMap(LAZY_MODULE_MAP)]
}).then(html => writeFileSync(join('browser', 'index.html'), html));
开发者ID:sumanbh,项目名称:amazon-clone,代码行数:23,代码来源:prerender.ts


示例10: renderModuleFactory

 .then((_) =>
   renderModuleFactory(AppServerModuleNgFactory, {
     document: index,
     url: route,
     extraProviders: [provideModuleMap(LAZY_MODULE_MAP)]
   })
开发者ID:k3nsei,项目名称:angular2-in-viewport,代码行数:6,代码来源:prerender.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript core.ConfigService类代码示例发布时间:2022-05-28
下一篇:
TypeScript express-engine.ngExpressEngine函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap