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

247
Views
getElementById (parámetro) no funciona en angular cuando se intenta usar el parámetro dinámico

Estoy tratando de usar getElementById("id"+i) donde de "i" se importa de un *ngIf, obtengo el parámetro correcto para de getElementById("id"+i) pero cuando lo uso, aparece como " indefinido"

 sendDeleteRequest( id: string): Observable<any> {const requestOptions: Object = { responseType: 'text' } return this.http.delete<any>(`https://arg-prog-backend.herokuapp.com/educacion/borrar/${id}`, requestOptions); } delete_paragraph(i : number){ const elementId = i const elementIdStr= elementId.toString() const id =(<HTMLInputElement>document.getElementById(elementIdStr))?.value; this.sendDeleteRequest(id).subscribe((res:any)=>{}); console.log(elementIdStr) }

y el código HTML:

 <h3 style="display: block;" id = "{{i}}" >{{educacion?.id}}</h3> <h2>{{educacion?.school}}</h2> <h3>{{educacion?.years}}</h3> <p>{{educacion?.carreer}}</p>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si desea obtener getElementById("id"+i) , su html debe ser: id="id{{i}}" .

about 4 years ago · Juan Pablo Isaza Report
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!