From 70a05a5157f6a08436cc9b8b81f42af2ebd22bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de> Date: Mon, 4 Mar 2019 04:01:13 +0100 Subject: [PATCH] Try to change room-joining input field to type number --- src/app/components/shared/room-join/room-join.component.html | 4 ++-- src/app/components/shared/room-join/room-join.component.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/components/shared/room-join/room-join.component.html b/src/app/components/shared/room-join/room-join.component.html index 9e31e80bb..1578de81f 100644 --- a/src/app/components/shared/room-join/room-join.component.html +++ b/src/app/components/shared/room-join/room-join.component.html @@ -2,8 +2,8 @@ <form (ngSubmit)="joinRoom(roomId.value)"> <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px"> <mat-form-field class="number"> - <input matInput #roomId placeholder="Session-Id" [formControl]="roomFormControl" - [errorStateMatcher]="matcher" maxlength="8"/> + <input matInput inputmode="numeric" type="number" pattern="[0-9]*" #roomId placeholder="Session-Id" [formControl]="roomFormControl" + [errorStateMatcher]="matcher" max="8"/> <mat-hint align="end">{{roomId.value.length}} / 8</mat-hint> <mat-error *ngIf="roomFormControl.hasError('required')">{{ 'home-page.please-enter' | translate}}</mat-error> <mat-error *ngIf="roomFormControl.hasError('minlength')">{{ 'home-page.exactly-8' | translate}}</mat-error> diff --git a/src/app/components/shared/room-join/room-join.component.ts b/src/app/components/shared/room-join/room-join.component.ts index 1a556ec76..a7a0fb4cf 100644 --- a/src/app/components/shared/room-join/room-join.component.ts +++ b/src/app/components/shared/room-join/room-join.component.ts @@ -10,7 +10,7 @@ import { TranslateService } from '@ngx-translate/core'; import { AuthenticationService } from '../../../services/http/authentication.service'; import { UserRole } from '../../../models/user-roles.enum'; import { User } from '../../../models/user'; -import {log} from "util"; +import { log } from 'util'; export class JoinErrorStateMatcher implements ErrorStateMatcher { isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { @@ -30,7 +30,7 @@ export class RoomJoinComponent implements OnInit { demoId = '95680586'; user: User; - roomFormControl = new FormControl('', [Validators.required, Validators.minLength(8)]); + roomFormControl = new FormControl('', [Validators.required, Validators.minLength(8), Validators.maxLength(8)]); matcher = new RegisterErrorStateMatcher(); -- GitLab