Bonjour, j'éxécute mon angular formulaire et j'ai eu cette erreur error TS2339: Property 'hide' does not exist on type 'LoginComponent'
voilà la page login.component.ts:
import { Component, OnInit } from '@angular/core';
import { FormControl,FormGroup,Validators } from '@angular/forms';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
loginForm!:any;
constructor(){ }
ngOnInit(){
this.loginForm=new FormGroup(
{
email:new FormControl('',[Validators.required,Validators.email]),
password:new FormControl('',[Validators.required,Validators.minLength(6)])
}
);
}
onLogin(){
}
}
voilà login.component.html
<mat-card>
<mat-card-content>
<div class="header">
<h2>LOGIN</h2>
</div>
<form (ngSubmit)="onLogin()" name="loginForm" [formGroup]="loginForm">
<div class="email-input">
<mat-form-field class="full-width" appearance="outline">
<mat-label>Email</mat-label>
<input formControlName="email" matInput required />
<mat-error *ngIf="loginForm.get('email').errors?.required">
Required email address
</mat-error>
</mat-form-field>
</div>
<div>
<span class="aLink">Forgot Password</span>
<mat-form-field class="full-width" appearance="outline">
<mat-label>Password</mat-label>
<input formControlName="password" matInput[type]="hide ? 'password' : 'text'" required/>
<button mat-icon-button matSuffix (click)="hide = !hide"
[attr.aria-label]="'Hide Password'" [attr.aira-pressed]="hide">
<mat-icon>{{ hide ? 'visibility_off' : 'visibility'}}</mat-icon>
</button>
<mat-error *ngIf="loginForm.get('password').errors?.required">
Required password
</mat-error>
</mat-form-field>
</div>
<button mat-flat-button color="primary">Login</button>
</form>
</mat-card-content>
</mat-card>
voilà le texte d'erreur que j'ai eu
Error: src/app/components/login/login.component.html:22:44 - error TS2339: Property 'hide' does not exist on type 'LoginComponent'.
22 <button mat-icon-button matSuffix (click)="hide = !hide"
~~~~
src/app/components/login/login.component.ts:5:16
5 templateUrl: './login.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component LoginComponent.
Configuration: Windows / Chrome 98.0.4758.102
Afficher la suite