I have tried to disable all html elements in a form in Angular 16.
But it is not working as expected.
But in the Google Login Form all fields including <a>
tag are in disabled state.
This my login.component.html
<div class="signin-wrapper">
<mat-card>
<form [formGroup]="loginForm" (ngSubmit)="onFormSubmit()">
<mat-card-header>
<mat-card-title>Sign in</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field appearance="outline">
<mat-label>Email</mat-label>
<input required matInput type="email" placeholder="eg. test@email.com" formControlName="userEmailAddress">
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Password</mat-label>
<input required matInput type="password" placeholder="eg. ************" formControlName="userPassword">
</mat-form-field>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" type="submit">Sign in</button>
</mat-card-actions>
<mat-card-footer>
<div class="text-center">Not Registered? <a routerLink="../register">Register</a></div>
</mat-card-footer>
</form>
<mat-progress-bar *ngIf="inProgress" mode="indeterminate"></mat-progress-bar>
</mat-card>
</div>
I am using
this.loginForm.disable()
to disable the form. The result is
In the above form <a>
tag and <button>
are not disabled.
Then I tried with <fieldset [disabled]="true">
<div class="signin-wrapper">
<mat-card>
<form [formGroup]="loginForm" (ngSubmit)="onFormSubmit()">
<fieldset [disabled]="true">
<mat-card-header>
<mat-card-title>SIgn in</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field appearance="outline">
<mat-label>Email</mat-label>
<input required matInput type="email" placeholder="eg. test@email.com" formControlName="userEmailAddress">
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Password</mat-label>
<input required matInput type="password" placeholder="eg. ************" formControlName="userPassword">
</mat-form-field>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" type="submit">Sign in</button>
</mat-card-actions>
<mat-card-footer>
<div class="text-center">Not Registered? <a routerLink="../register">Register</a></div>
</mat-card-footer>
</fieldset>
</form>
<mat-progress-bar *ngIf="inProgress" mode="indeterminate"></mat-progress-bar>
</mat-card>
</div>
The result is
Still <a>
tag is in enabled condition.
Is it possible to do like Google?