angular-docs-cn/angular.io/src/app/doc-viewer/doc-viewer.component.ts
2017-02-02 23:28:00 -08:00

21 lines
474 B
TypeScript

import { Component, Input, ElementRef, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'aio-doc-viewer',
template: ''
// TODO(robwormald): shadow DOM and emulated don't work here (?!)
// encapsulation: ViewEncapsulation.Native
})
export class DocViewerComponent {
@Input()
set doc(currentDoc) {
if (currentDoc) {
this.element.nativeElement.innerHTML = currentDoc.content;
}
}
constructor(private element: ElementRef) { }
}