Create initial version of TerminalComponent

This commit is contained in:
Bálint Bokros 2018-01-17 17:25:34 +01:00
parent 4607219ed6
commit 5846defd2c
4 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1 @@
<div #xterm class="tfw-xterm mt-3 mb-3" (window:resize)="fit()"></div>

View File

View 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();
}
}

View File

@ -1,2 +1,3 @@
/* You can add global styles to this file, and also import other style files */
@import '../node_modules/bootstrap/scss/bootstrap';
@import '../node_modules/xterm/dist/xterm.css';