feat(platform-server): add API to render Module and ModuleFactory to string (#14381)
- PlatformState provides an interface to serialize the current Platform State as a string or Document. - renderModule and renderModuleFactory are convenience methods to wait for Angular Application to stabilize and then render the state to a string. - refactor code to remove defaultDoc from DomAdapter and inject DOCUMENT where it's needed.
This commit is contained in:
@ -55,7 +55,6 @@ export class WorkerDomAdapter extends DomAdapter {
|
||||
set attrToPropMap(value: {[key: string]: string}) { throw 'not implemented'; }
|
||||
|
||||
parse(templateHtml: string) { throw 'not implemented'; }
|
||||
query(selector: string): any { throw 'not implemented'; }
|
||||
querySelector(el: any /** TODO #9100 */, selector: string): HTMLElement {
|
||||
throw 'not implemented';
|
||||
}
|
||||
@ -169,10 +168,9 @@ export class WorkerDomAdapter extends DomAdapter {
|
||||
}
|
||||
templateAwareRoot(el: any /** TODO #9100 */) { throw 'not implemented'; }
|
||||
createHtmlDocument(): HTMLDocument { throw 'not implemented'; }
|
||||
defaultDoc(): HTMLDocument { throw 'not implemented'; }
|
||||
getBoundingClientRect(el: any /** TODO #9100 */) { throw 'not implemented'; }
|
||||
getTitle(): string { throw 'not implemented'; }
|
||||
setTitle(newTitle: string) { throw 'not implemented'; }
|
||||
getTitle(doc: Document): string { throw 'not implemented'; }
|
||||
setTitle(doc: Document, newTitle: string) { throw 'not implemented'; }
|
||||
elementMatches(n: any /** TODO #9100 */, selector: string): boolean { throw 'not implemented'; }
|
||||
isTemplateElement(el: any): boolean { throw 'not implemented'; }
|
||||
isTextNode(node: any /** TODO #9100 */): boolean { throw 'not implemented'; }
|
||||
@ -189,10 +187,10 @@ export class WorkerDomAdapter extends DomAdapter {
|
||||
}
|
||||
supportsDOMEvents(): boolean { throw 'not implemented'; }
|
||||
supportsNativeShadowDOM(): boolean { throw 'not implemented'; }
|
||||
getGlobalEventTarget(target: string): any { throw 'not implemented'; }
|
||||
getGlobalEventTarget(doc: Document, target: string): any { throw 'not implemented'; }
|
||||
getHistory(): History { throw 'not implemented'; }
|
||||
getLocation(): Location { throw 'not implemented'; }
|
||||
getBaseHref(): string { throw 'not implemented'; }
|
||||
getBaseHref(doc: Document): string { throw 'not implemented'; }
|
||||
resetBaseElement(): void { throw 'not implemented'; }
|
||||
getUserAgent(): string { throw 'not implemented'; }
|
||||
setData(element: any /** TODO #9100 */, name: string, value: string) { throw 'not implemented'; }
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {APP_INITIALIZER, ApplicationModule, ErrorHandler, NgModule, NgZone, PlatformRef, Provider, RootRenderer, createPlatformFactory, platformCore} from '@angular/core';
|
||||
import {DOCUMENT} from '@angular/platform-browser';
|
||||
|
||||
import {BROWSER_SANITIZATION_PROVIDERS} from './private_import_platform-browser';
|
||||
import {ON_WEB_WORKER} from './web_workers/shared/api';
|
||||
@ -60,7 +61,7 @@ export function setupWebWorker(): void {
|
||||
*/
|
||||
@NgModule({
|
||||
providers: [
|
||||
BROWSER_SANITIZATION_PROVIDERS, Serializer,
|
||||
BROWSER_SANITIZATION_PROVIDERS, Serializer, {provide: DOCUMENT, useValue: null},
|
||||
{provide: ClientMessageBrokerFactory, useClass: ClientMessageBrokerFactory_},
|
||||
{provide: ServiceMessageBrokerFactory, useClass: ServiceMessageBrokerFactory_},
|
||||
WebWorkerRootRenderer, {provide: RootRenderer, useExisting: WebWorkerRootRenderer},
|
||||
|
@ -135,7 +135,7 @@ function _exceptionHandler(): ErrorHandler {
|
||||
}
|
||||
|
||||
function _document(): any {
|
||||
return getDOM().defaultDoc();
|
||||
return document;
|
||||
}
|
||||
|
||||
function createNgZone(): NgZone {
|
||||
|
Reference in New Issue
Block a user