I tried implementing a login feature using web API with Angular 7, but encountered an error when using
<form [formGroup]="loginForm" (submit)="loginFormSubmit()">
. What could be causing this issue?
https://i.sstatic.net/3M2a5.jpg
login.component.html
<form [formGroup]="loginForm" (submit)="loginFormSubmit()">
<h2 class="text-center red heading text-heading">LOGIN</h2>
<div class="form-group custom-input">
<div>
<span style="color: #D56161;" class="lblMessage"></span>
</div><br>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="fa fa-user"></i>
</span>
</div>
<input class="form-control" data-val="true" data-val-required="required" formControlName="userId" placeholder="Username" type="text" value="">
<small class="text-danger" *ngIf="loginForm.form-control.userId.invalid && (loginFormSubmitted || loginForm.controls.userId.touched)">Required</small>
</div>
<div style="text-align:left">
<span class="field-validation-valid" data-valmsg-for="UserName" data-valmsg-replace="true" style="color:#D56161;"></span>
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="fa fa-lock"></i>
</span>
</div>
<input class="form-control" data-val="true" data-val-required="required" id="Password" formControlName="Password" placeholder="Password" type="password">
<small class="text-danger" *ngIf="loginForm.controls.password.invalid && (loginFormSubmitted || loginForm.controls.password.invalid)">Required</small>
</div>
<div style="text-align:left">
<span class="field-validation-valid" data-valmsg-for="Password" data-valmsg-replace="true" style="color:#D56161;"></span>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-block btn-primary button login" [disabled]="loginFormSubmitted">LOGIN <i class="fa fa-arrow-right"></i></button>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<a class="float-left" href="/Admin/ForgotPassword">Forgot Password?</a>
<a class="float-right" href="">Back to Website</a>
</div>
</div>
</form>
login.component.ts
import { Component } from '@angular/core';
import { ApiService } from '../../../../services/api/api.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-login',
templateUrl: './login.component.html'
})
export class loginComponent{
users$: object;
constructor(private data: ApiService){
}
ngOnInit(){
}
loginFormSubmit(){
alert('login alert');
}
}
What steps can I take to address this issue?
Appreciate any guidance!