aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_modals/login-modal/login-modal.component.ts
diff options
context:
space:
mode:
authorSonja Galovic <galovicsonja@gmail.com>2022-05-10 17:54:57 +0200
committerSonja Galovic <galovicsonja@gmail.com>2022-05-10 17:54:57 +0200
commit6754cb8d4fa9fe6938eb7c3bea7f60d96caad9e6 (patch)
tree5d01e7a8fd1fc92b7be114a4e3a4bd1cc2b33591 /frontend/src/app/_modals/login-modal/login-modal.component.ts
parent2c132a08bc852b4e88daf067459856a883329c31 (diff)
Svi modali/dijalozi: omogucen submit preko entera. Sredjen izgled modala.
Diffstat (limited to 'frontend/src/app/_modals/login-modal/login-modal.component.ts')
-rw-r--r--frontend/src/app/_modals/login-modal/login-modal.component.ts13
1 files changed, 11 insertions, 2 deletions
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() {