Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
El validador angular no funciona para mostrar un DIV

Quiero mostrar un div (clase alert.alert-danger) debajo del campo de entrada para "CONTRASEÑA ANTIGUA" si la contraseña anterior no es igual a '12345', pero no aparece.

Mi código:

CONTRASEÑA.COMPONENTE.TS:

 form = new FormGroup({ oldpass: new FormControl( '', [Validators.required], [OldPassValidator.OldPass]) }

CONTRASEÑA.COMPONENTE.HTML:

 <form [formGroup]="form"> <div class="form-group"> <label for="">Old password</label> <input type="password" formControlName="oldpass" id="oldpass" class="form-control" [class.redBorder]="oldpass?.touched && oldpass?.invalid"> </div> <div class="alert alert-danger" *ngIf="oldpass?.touched && oldpass?.errors?.required"> <div *ngIf="oldpass?.touched && oldpass?.errors?.required">Old pass is required</div> <div *ngIf="oldpass?.errors?.OldPass">Password is not correct</div> </div> </form>

VALIDADOR.TS:

 static OldPass(control: AbstractControl) : Promise<ValidationErrors | null> { return new Promise((resolve, reject) => { if(control.value === '12345') return resolve({ OldPass: true }); else return resolve(null); }); }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!