How to use the @nguniversal/aspnetcore-engine.ngAspnetCoreEngine function in @nguniversal/aspnetcore-engine

To help you get started, we’ve selected a few @nguniversal/aspnetcore-engine 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 TrilonIO / aspnetcore-angular-universal / ClientApp / boot.server.ts View on Github external
export default createServerRenderer((params) => {

  // Platform-server provider configuration
  const setupOptions: IEngineOptions = {
    appSelector: '',
    ngModule: AppModule,
    request: params,
    providers: [
      // Optional - Any other Server providers you want to pass
      // (remember you'll have to provide them for the Browser as well)
    ]
  };

  return ngAspnetCoreEngine(setupOptions).then(response => {

    // Apply your transferData to response.globals
    response.globals.transferData = createTransferScript({
      someData: 'Transfer this to the client on the window.TRANSFER_CACHE {} object',
      fromDotnet: params.data.thisCameFromDotNET // example of data coming from dotnet, in HomeController
    });

    return ({
      html: response.html, // our  serialized
      globals: response.globals // all of our styles/scripts/meta-tags/link-tags for aspnet to serve up
    });
  });
});
github Swastika-IO / sio.core / src / Swastika.IO.Core / ClientApp / boot.server.ts View on Github external
export default createServerRenderer((params) => {

  // Platform-server provider configuration
  const setupOptions: IEngineOptions = {
    appSelector: '',
    ngModule: AppModule,
    request: params,
    providers: [
      // Optional - Any other Server providers you want to pass
      // (remember you'll have to provide them for the Browser as well)
    ]
  };

  return ngAspnetCoreEngine(setupOptions).then(response => {

    // Apply your transferData to response.globals
    response.globals.transferData = createTransferScript({
      someData: 'Transfer this to the client on the window.TRANSFER_CACHE {} object',
      fromDotnet: params.data.thisCameFromDotNET // example of data coming from dotnet, in HomeController
    });

    return ({
      html: response.html, // our  serialized
      globals: response.globals // all of our styles/scripts/meta-tags/link-tags for aspnet to serve up
    });
  });
});
github TrilonIO / aspnetcore-angular-universal / ClientApp / boot.server.PRODUCTION.ts View on Github external
export default createServerRenderer(params => {
  // Platform-server provider configuration
  const setupOptions: IEngineOptions = {
    appSelector: '',
    ngModule: AppModuleNgFactory,
    request: params,
    providers: [
      // Optional - Any other Server providers you want to pass
      // (remember you'll have to provide them for the Browser as well)
    ]
  };

  return ngAspnetCoreEngine(setupOptions).then(response => {
    // Apply your transferData to response.globals
    response.globals.transferData = createTransferScript({
      someData:
        'Transfer this to the client on the window.TRANSFER_CACHE {} object',
      fromDotnet: params.data.thisCameFromDotNET // example of data coming from dotnet, in HomeController
    });

    return {
      html: response.html, // our  serialized
      globals: response.globals // all of our styles/scripts/meta-tags/link-tags for aspnet to serve up
    };
  });
});

@nguniversal/aspnetcore-engine

ASP.NET Core Engine for running Server Angular Apps

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis