docs(platform-server): inline PlatformOptions and add doc strings (#18264)
Fix documentation for the options passed into renderModule and renderModuleFactory. PR Close #18264
This commit is contained in:
parent
ce47546188
commit
4cea2bd612
|
@ -18,26 +18,9 @@ import {INITIAL_CONFIG} from './tokens';
|
|||
|
||||
const parse5 = require('parse5');
|
||||
|
||||
/**
|
||||
* Options used to configure the server Platform instance that is created in {@link renderModule}
|
||||
* and {@link renderModuleFactory}.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export interface PlatformOptions {
|
||||
/**
|
||||
* The full document HTML of the page to render as a string.
|
||||
*/
|
||||
interface PlatformOptions {
|
||||
document?: string;
|
||||
|
||||
/**
|
||||
* The URL for the current render request.
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
* Platform level providers for the current render request.
|
||||
*/
|
||||
extraProviders?: Provider[];
|
||||
}
|
||||
|
||||
|
@ -74,12 +57,18 @@ the server-rendered app can be properly bootstrapped into a client app.`);
|
|||
/**
|
||||
* Renders a Module to string.
|
||||
*
|
||||
* `document` is the full document HTML of the page to render, as a string.
|
||||
* `url` is the URL for the current render request.
|
||||
* `extraProviders` are the platform level providers for the current render request.
|
||||
*
|
||||
* Do not use this in a production server environment. Use pre-compiled {@link NgModuleFactory} with
|
||||
* {link renderModuleFactory} instead.
|
||||
* {@link renderModuleFactory} instead.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export function renderModule<T>(module: Type<T>, options: PlatformOptions): Promise<string> {
|
||||
export function renderModule<T>(
|
||||
module: Type<T>,
|
||||
options: {document?: string, url?: string, extraProviders?: Provider[]}): Promise<string> {
|
||||
const platform = _getPlatform(platformDynamicServer, options);
|
||||
return _render(platform, platform.bootstrapModule(module));
|
||||
}
|
||||
|
@ -87,10 +76,15 @@ export function renderModule<T>(module: Type<T>, options: PlatformOptions): Prom
|
|||
/**
|
||||
* Renders a {@link NgModuleFactory} to string.
|
||||
*
|
||||
* `document` is the full document HTML of the page to render, as a string.
|
||||
* `url` is the URL for the current render request.
|
||||
* `extraProviders` are the platform level providers for the current render request.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export function renderModuleFactory<T>(
|
||||
moduleFactory: NgModuleFactory<T>, options: PlatformOptions): Promise<string> {
|
||||
moduleFactory: NgModuleFactory<T>,
|
||||
options: {document?: string, url?: string, extraProviders?: Provider[]}): Promise<string> {
|
||||
const platform = _getPlatform(platformServer, options);
|
||||
return _render(platform, platform.bootstrapModuleFactory(moduleFactory));
|
||||
}
|
||||
|
|
|
@ -21,10 +21,18 @@ export declare class PlatformState {
|
|||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare function renderModule<T>(module: Type<T>, options: PlatformOptions): Promise<string>;
|
||||
export declare function renderModule<T>(module: Type<T>, options: {
|
||||
document?: string;
|
||||
url?: string;
|
||||
extraProviders?: Provider[];
|
||||
}): Promise<string>;
|
||||
|
||||
/** @experimental */
|
||||
export declare function renderModuleFactory<T>(moduleFactory: NgModuleFactory<T>, options: PlatformOptions): Promise<string>;
|
||||
export declare function renderModuleFactory<T>(moduleFactory: NgModuleFactory<T>, options: {
|
||||
document?: string;
|
||||
url?: string;
|
||||
extraProviders?: Provider[];
|
||||
}): Promise<string>;
|
||||
|
||||
/** @experimental */
|
||||
export declare class ServerModule {
|
||||
|
|
Loading…
Reference in New Issue