import { Component } from '@angular/core' ; import { RoomService } from '../core' ; import { IRoom } from '../../models' ; @ Component ( { selector : 'control' , styleUrls : [ './control.component.scss' ] , templateUrl : './control.component.html' } ) export class ControlComponent { room : string = '' ; newRoom : string = '' ; constructor ( public roomService ) { } join ( ) { this . roomService . join ( this . room ) ; this . room = '' ; } create ( ) { this . roomService . create ( this . newRoom ) ; this . newRoom = '' ; } remove ( ) { this . roomService . remove ( this . room ) ; this . room = '' ; } eventHandler ( event ) { if ( event . key === 'Enter' ) { this . create ( ) ; } } }