add template

This commit is contained in:
Cetin Cakiroglu
2021-12-09 17:24:42 +03:00
parent cf85fcad02
commit 89b1bf58fa
440 changed files with 292236 additions and 9948 deletions

View File

@@ -0,0 +1,34 @@
import { Component, ElementRef, AfterViewInit, Input, NgModule, ViewChild } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-code',
template: `
<pre [ngClass]="'language-' + lang"><code #code><ng-content></ng-content>
</code></pre>
`,
styleUrls: ['./app.code.component.scss']
})
export class AppCodeComponent implements AfterViewInit {
@Input() lang = 'markup';
@ViewChild('code') codeViewChild: ElementRef;
constructor(public el: ElementRef) { }
ngAfterViewInit() {
// @ts-ignore
if (window['Prism']) {
// @ts-ignore
window['Prism'].highlightElement(this.codeViewChild.nativeElement);
}
}
}
@NgModule({
imports: [CommonModule],
exports: [AppCodeComponent],
declarations: [AppCodeComponent]
})
export class AppCodeModule { }