Skip to content
Snippets Groups Projects
Commit 64d727f2 authored by Tom Käsler's avatar Tom Käsler
Browse files

Join room on enter

parent 6af75afb
Branches
Tags
No related merge requests found
<div fxLayout="column" fxLayoutAlign="center center" fxlayoutgap="50px" fxFill>
<form (ngSubmit)="joinRoom(roomId.value)">
<div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px">
<mat-form-field>
<mat-form-field (keyup.enter)="onEnter()">
<input matInput #roomId type="text" pattern="[0-9 ]*" inputmode="numeric" min="00000000" max="99999999"
onkeydown="if(this.value.length - (this.value.split(' ').length -1) === 8 && event.keyCode != 8) return false;
if(this.value.length === 4 && event.keyCode != 8) this.value = this.value + ' ';"
......
......@@ -46,6 +46,10 @@ export class RoomJoinComponent implements OnInit {
this.authenticationService.watchUser.subscribe(newUser => this.user = newUser);
}
onEnter() {
this.getRoom(this.roomIdElement.nativeElement.value);
}
getRoom(id: string): void {
if (id.length - (id.split(' ').length - 1) < 8) {
this.translateService.get('home-page.exactly-8').subscribe(message => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment