• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

192
Views
No se puede vincular a 'objetivo' ya que no es una propiedad conocida de 'div'

Recibo este error al implementar la función de colapso:

Error: errores de análisis de plantilla: no se puede vincular a 'objetivo' ya que no es una propiedad conocida de 'div'

aplicación.componente.html:

 <div *ngFor = "let ele of elements; let RowIndex = index"> {{ele.name}} <button data-toggle="collapse" data-target="#demo{{RowIndex}}">Toggle </button> <div id="demo{{RowIndex}}" class="collapse">Lorem Ipsum</div> </div>

Pero si simplemente uso data-target="#demo" , funciona bien. Pero cuando estoy vinculando {{RowIndex}} , muestra un error.

about 3 years ago · Santiago Trujillo
3 answers
Answer question

0

Te perdiste el enlace de propiedad

 <button data-toggle="collapse" [attr.data-target]="'#demo'+ RowIndex">Toggle </button> <button (click)="clickMe($event)">Toggle</button> clickMe(value){ value.srcElement.innerHTML="Clicked"; }
about 3 years ago · Santiago Trujillo Report

0

Use la sintaxis de enlace de atributos de angular.

Utilice uno de los siguientes:

 <button data-toggle="collapse" attr.data-target="#demo{{RowIndex}}">Toggle </button>

o

 <button data-toggle="collapse" [attr.data-target]="'#demo' + RowIndex">Toggle </button>
about 3 years ago · Santiago Trujillo Report

0

usar enlace de propiedad: attr.data-target="{{your-target}}"

about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error