-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver-form.component.ts
More file actions
33 lines (28 loc) · 1004 Bytes
/
server-form.component.ts
File metadata and controls
33 lines (28 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {Component, ElementRef, EventEmitter, OnInit, Output, ViewChild} from '@angular/core';
@Component({
selector: 'ch-server-form',
templateUrl: './server-form.component.html',
styleUrls: ['./server-form.component.css']
})
export class ServerFormComponent implements OnInit {
@Output() serverAdded = new EventEmitter<{name: string, content: string}>();
@Output() blueprintAdded = new EventEmitter<{name: string, content: string}>()
// newServerName = '';
// newServerContent = '';
@ViewChild('serverContentInput', {static: true}) serverContentInput: ElementRef;
constructor() { }
ngOnInit() {
}
onAddServer(serverNameInput: HTMLInputElement) {
this.serverAdded.emit({
name: serverNameInput.value,
content: this.serverContentInput.nativeElement.value
});
}
onAddBlueprint(serverNameInput: HTMLInputElement) {
this.blueprintAdded.emit({
name: serverNameInput.value,
content: this.serverContentInput.nativeElement.value
});
}
}