When working in an HTML file, I am using ngModel to retrieve a value that I want to utilize in my component.
edit-customer.component.html
<input id="userInfoEmail" type="text" class="form-control" value="{{userInfo.email}}" [(ngModel)]="userInfo.email" disabled>
Since it is utilizing two-way binding, I have implemented it in my component as shown below:
edit-customer.component.ts
checkUserEmail(): void {
this.userInfo.email = this.userEmail;
this.customerService.checkEmail(this.userEmail).subscribe((res) => {
if (res.twoFactorEnabled === true) {
this.isButtonDisabled = false;
}
else {
this.isButtonDisabled = true;
}
})
}
I have also declared this.userEmail:string;
, however, I encountered an error displaying 'undefined' on my console. After reading about the necessity of initializing the object, I am currently stuck trying to figure out how to proceed.