mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 16:51:56 +00:00
30 lines
735 B
TypeScript
30 lines
735 B
TypeScript
import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
|
|
import { TerminadoService } from '../terminado.service';
|
|
|
|
|
|
@Component({
|
|
selector: 'app-terminal',
|
|
templateUrl: './terminal.component.html',
|
|
styleUrls: ['./terminal.component.scss']
|
|
})
|
|
export class TerminalComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
@ViewChild('xterm') target: ElementRef;
|
|
|
|
constructor(private terminadoService: TerminadoService) { }
|
|
|
|
ngOnInit() {
|
|
}
|
|
|
|
ngAfterViewInit() {
|
|
this.terminadoService.attach(this.target.nativeElement as HTMLElement);
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.terminadoService.detach();
|
|
}
|
|
|
|
fit() {
|
|
this.terminadoService.fit();
|
|
}
|
|
}
|