MCPcopy Create free account
hub / github.com/angular/components / document

Method document

docs/src/app/shared/doc-viewer/doc-viewer.ts:97–111  ·  view source on GitHub ↗
(document: string | ComponentType<any> | undefined)

Source from the content-addressed store, hash-verified

95 /** The document to display, either as a URL to a markdown file or a component to create. */
96 @Input()
97 set document(document: string | ComponentType<any> | undefined) {
98 if (typeof document === 'string') {
99 this._fetchDocument(document);
100 } else if (document) {
101 this.portal = new ComponentPortal(document);
102
103 // Resolving and creating components dynamically in Angular happens synchronously, but since
104 // we want to emit the output if the components are actually rendered completely, we wait
105 // until the Angular zone becomes stable.
106 // tslint:disable-next-line:no-zone-dependencies
107 this._ngZone.onStable
108 .pipe(take(1))
109 .subscribe(() => this.contentRendered.next(this._elementRef.nativeElement));
110 }
111 }
112
113 @Output() contentRendered = new EventEmitter<HTMLElement>();
114

Callers

nothing calls this directly

Calls 2

_fetchDocumentMethod · 0.95
nextMethod · 0.45

Tested by

no test coverage detected