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
3ca2a0aa37
commit
bcf6b90c95
@ -18,26 +18,9 @@ import {INITIAL_CONFIG} from './tokens';
|
|||||||
|
|
||||||
const parse5 = require('parse5');
|
const parse5 = require('parse5');
|
||||||
|
|
||||||
/**
|
interface PlatformOptions {
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
document?: string;
|
document?: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* The URL for the current render request.
|
|
||||||
*/
|
|
||||||
url?: string;
|
url?: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Platform level providers for the current render request.
|
|
||||||
*/
|
|
||||||
extraProviders?: Provider[];
|
extraProviders?: Provider[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,12 +57,18 @@ the server-rendered app can be properly bootstrapped into a client app.`);
|
|||||||
/**
|
/**
|
||||||
* Renders a Module to string.
|
* 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
|
* Do not use this in a production server environment. Use pre-compiled {@link NgModuleFactory} with
|
||||||
* {link renderModuleFactory} instead.
|
* {@link renderModuleFactory} instead.
|
||||||
*
|
*
|
||||||
* @experimental
|
* @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);
|
const platform = _getPlatform(platformDynamicServer, options);
|
||||||
return _render(platform, platform.bootstrapModule(module));
|
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.
|
* 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
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export function renderModuleFactory<T>(
|
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);
|
const platform = _getPlatform(platformServer, options);
|
||||||
return _render(platform, platform.bootstrapModuleFactory(moduleFactory));
|
return _render(platform, platform.bootstrapModuleFactory(moduleFactory));
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,18 @@ export declare class PlatformState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @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 */
|
/** @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 */
|
/** @experimental */
|
||||||
export declare class ServerModule {
|
export declare class ServerModule {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user