Updated to angular 11
Now compiling with strict mode in typescript Need to error checking now
This commit is contained in:
@ -12,7 +12,7 @@ import { AuthService } from '../auth.service';
|
||||
styleUrls: ['./login.component.css'],
|
||||
})
|
||||
export class LoginComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement: ElementRef;
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
hide: boolean;
|
||||
showOtp: boolean;
|
||||
@ -29,10 +29,10 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
) {
|
||||
this.hide = true;
|
||||
this.showOtp = false;
|
||||
this.createForm();
|
||||
}
|
||||
this.clientId = '';
|
||||
this.returnUrl = '';
|
||||
|
||||
createForm() {
|
||||
// Create form
|
||||
this.form = this.fb.group({
|
||||
username: '',
|
||||
password: '',
|
||||
@ -46,7 +46,9 @@ export class LoginComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
this.nameElement.nativeElement.focus();
|
||||
if (this.nameElement !== undefined) {
|
||||
this.nameElement.nativeElement.focus();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user