mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-06-28 19:25:13 +00:00
Create initial version of TerminalComponent
This commit is contained in:
1
src/app/terminal/terminal.component.html
Normal file
1
src/app/terminal/terminal.component.html
Normal file
@ -0,0 +1 @@
|
||||
<div #xterm class="tfw-xterm mt-3 mb-3" (window:resize)="fit()"></div>
|
0
src/app/terminal/terminal.component.scss
Normal file
0
src/app/terminal/terminal.component.scss
Normal file
29
src/app/terminal/terminal.component.ts
Normal file
29
src/app/terminal/terminal.component.ts
Normal file
@ -0,0 +1,29 @@
|
||||
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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user