Chore: Moved from Untyped to Stongly Typed forms.

This commit is contained in:
2022-07-15 13:24:25 +05:30
parent facf2df91e
commit 28f9bf2180
78 changed files with 1091 additions and 1004 deletions

View File

@ -1,5 +1,5 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { ToasterService } from '../../core/toaster.service';
@ -13,7 +13,7 @@ import { AuthService } from '../auth.service';
})
export class LoginComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
form: UntypedFormGroup;
form: FormGroup;
hide: boolean;
showOtp: boolean;
clientId = '';
@ -25,14 +25,13 @@ export class LoginComponent implements OnInit, AfterViewInit {
private router: Router,
private toaster: ToasterService,
private cs: CookieService,
private fb: UntypedFormBuilder,
) {
this.hide = true;
this.showOtp = false;
this.form = this.fb.group({
username: '',
password: '',
otp: '',
this.form = new FormGroup({
username: new FormControl('', { validators: Validators.required, nonNullable: true }),
password: new FormControl('', { validators: Validators.required, nonNullable: true }),
otp: new FormControl(0),
});
}