David R
David R

Reputation: 15647

Concatenating output parameter value and binding expression

In my template I have the following block of code which has a loop from which I'm displaying a datepicker,

<tbody>
  <tr *ngFor="let item of purchaseOrderService.purchases">
   <td>
    <date [(ngModel)]="item.purchasedDate" [validationData]="validationObj.group.chkDate"></date>
   </td>
  </tr>
</tbody>

Now I need to concatenate a value of item object along with validationObj.group.chkDate for which when I tried like this,

[validationData]="validationObj.group.chkDate.{{item.datePurchased}}"></date>

It is throwing some template errors, Any idea how to achieve the concatenation?

Upvotes: 0

Views: 37

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136154

Using {{}}(interpolation) inside property binding will not allowed by Angular parser. But in this case for getting specific property value you can't use this expression, this will result into an error.

Rather I'd recommend you to access Object by its key.

[validationData]="validationObj.group.chkDate[item.datePurchased]"

Upvotes: 2

Related Questions