From 6754cb8d4fa9fe6938eb7c3bea7f60d96caad9e6 Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Tue, 10 May 2022 17:54:57 +0200 Subject: Svi modali/dijalozi: omogucen submit preko entera. Sredjen izgled modala. --- .../src/app/_modals/login-modal/login-modal.component.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'frontend/src/app/_modals/login-modal/login-modal.component.ts') diff --git a/frontend/src/app/_modals/login-modal/login-modal.component.ts b/frontend/src/app/_modals/login-modal/login-modal.component.ts index ccd78509..33c17c31 100644 --- a/frontend/src/app/_modals/login-modal/login-modal.component.ts +++ b/frontend/src/app/_modals/login-modal/login-modal.component.ts @@ -5,15 +5,17 @@ import { AuthService } from 'src/app/_services/auth.service'; import { UserInfoService } from 'src/app/_services/user-info.service'; import shared from '../../Shared'; import {AfterViewInit, ElementRef} from '@angular/core'; +import { MatSelect } from '@angular/material/select'; @Component({ selector: 'app-login-modal', templateUrl: './login-modal.component.html', styleUrls: ['./login-modal.component.css'] }) -export class LoginModalComponent implements OnInit { +export class LoginModalComponent implements AfterViewInit { @ViewChild('closeButton') closeButton?: ElementRef; + @ViewChild('usernameInput') usernameInput!: ElementRef; @ViewChild('pass') passwordInput!: ElementRef; username: string = ''; @@ -30,7 +32,14 @@ export class LoginModalComponent implements OnInit { private userInfoService: UserInfoService ) { } - ngOnInit(): void { + ngAfterViewInit(): void { + //console.log(this.usernameInput); + this.usernameInput.nativeElement.focus(); + } + + doLoginWithEnterKey(keyboardEvent: KeyboardEvent) { + if (keyboardEvent.code == "Enter" || keyboardEvent.code == "NumpadEnter") + this.doLogin(); } doLogin() { -- cgit v1.2.3