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

269
Views
No se pueden leer las propiedades de la casilla de verificación mat no definida (leyendo 'getAttribute')

Estoy tratando de usar algunos componentes de material angular, como mat-checkbox, pero cuando configuro un atributo personalizado, obtengo

No se pueden leer las propiedades de undefined (leyendo 'getAttribute')

El código utilizado es como va:

 <li *ngFor="let instancia of tipo_maquina.instancias"> <mat-checkbox (change)="onCheckChange($event, $event.source, $event.checked)" [attr.typeid]="instancia.id"> {{instancia.nombre}} </mat-checkbox> </li>
 onCheckChange(event: any, checkbox: MatCheckbox, isChecked: boolean){ console.log("check event") console.log(event.target.getAttribute('typeid')); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El tipo de $event debe ser MatCheckboxChange y tiene 2 propiedades

 /** Change event object emitted by MatCheckbox. */ export declare class MatCheckboxChange { /** The source MatCheckbox of the event. */ source: MatCheckbox; /** The new `checked` value of the checkbox. */ checked: boolean; }

Por lo tanto, el destino no existe en MatCheckboxChange y obtendrá un error de error TS2339: Property target' does not exist on type 'MatCheckboxChange' .

Como sugirió @MikeOne, simplemente pase instancia.id al onCheckChange($event, instancia.id) .

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!