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

0

176
Views
Template parse errors: Can't bind to 'item-value' since it isn't a known property of 'td'

I am trying to do following:

<tr id="row" *ngFor="let data of dataList">
   <td class="search-result" data-item-value="{{data.value}}">
      {{data.text}}
   </td>
</tr>

Here dataList is an array of object with prop value and text.

I am getting following error:

zone.js:522 Unhandled Promise rejection: Template parse errors: Can't bind to 'item-value' since it isn't a known property of 'td'. ("" *ngFor="let data of dataList"> ]data-item-value="{{data.value}}">{{data.text}} "): MultiListBoxComponent@24:66 ; Zone: ; Task: Promise.then ; Value: SyntaxError {__zone_symbol__error: Error: Template parse errors: Can't bind to 'item-value' since it isn't a known property of 'td'. ("……} Error: Template parse errors: Can't bind to 'item-value' since it isn't a known property of 'td'. ("" *ngFor="let data of dataList"> ]data-item-value="{{data.value}}">{{data.text}} "): MultiListBoxComponent@24:66

Is value binding to custom attributes not allowed in angular 2?

about 3 years ago · Santiago Trujillo
2 answers
Answer question

0

You have to use

[attr.data-item-value]="data.value"

instead of

data-item-value="{{data.value}}"
about 3 years ago · Santiago Trujillo Report

0

Check: https://stackoverflow.com/a/38792409/5049472

You could use DomSanitizationService with a function generating td.

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