(
doc: Document,
component: Type<unknown>,
options: {
envProviders?: Provider[];
hydrationFeatures?: () => HydrationFeature<HydrationFeatureKind>[];
} = {},
)
| 92 | } |
| 93 | |
| 94 | export function hydrate( |
| 95 | doc: Document, |
| 96 | component: Type<unknown>, |
| 97 | options: { |
| 98 | envProviders?: Provider[]; |
| 99 | hydrationFeatures?: () => HydrationFeature<HydrationFeatureKind>[]; |
| 100 | } = {}, |
| 101 | ) { |
| 102 | const {envProviders = [], hydrationFeatures = () => []} = options; |
| 103 | |
| 104 | // Apply correct reference to the `document` object, |
| 105 | // which will be used by runtime. |
| 106 | ɵsetDocument(doc); |
| 107 | |
| 108 | // Define `document` to make `DefaultDomRenderer2` work, since it |
| 109 | // references `document` directly to create style tags. |
| 110 | global.document = doc; |
| 111 | |
| 112 | const providers = [ |
| 113 | {provide: PLATFORM_ID, useValue: 'browser'}, |
| 114 | {provide: DOCUMENT, useFactory: () => doc}, |
| 115 | provideClientHydration(...hydrationFeatures()), |
| 116 | ...envProviders, |
| 117 | ]; |
| 118 | |
| 119 | return bootstrapApplication(component, {providers}); |
| 120 | } |
| 121 | |
| 122 | export function insertDomInDocument(doc: Document, html: string) { |
| 123 | // Get HTML contents of the `<app>`, create a DOM element and append it into the body. |
no test coverage detected
searching dependent graphs…