Reputation: 6500
I'm trying to get WareHouse Name from a list using its Id and populate the same in a table
<tbody>
<tr *ngFor="let data of sectionList;index as i">
<td>{{i+1}}</td>
<td>{{data.sectionName}}</td>
<td>{{wareHouseList.find(x=>x.Id == data.WareHouseId).wareHouseName}}</td>
<td>{{data.DestinationWareHouseId}}</td>
</tr>
</tbody>
But i keep getting this error in Console,Is is the correct way to include statements in typescript?
Bindings cannot contain assignments at column 22 in [{{wareHouseList.find(x=>x.Id == data.WareHouseId).sectionName}}]
Upvotes: 0
Views: 881
Reputation: 593
{{ }} means a binding.You can't use like that.
<tbody>
<tr *ngFor="let data of sectionList;index as i">
<td>{{i+1}}</td>
<td>{{data.sectionName}}</td>
<td>{{ returnPicked(data.WareHouseId) }}</td>
<td>{{data.DestinationWareHouseId}}</td>
</tr>
</tbody>
In your ts ->
public returnPicked(warhouseId): string {
return wareHouseList.find(x=>x.Id == warhouseId).wareHouseName;
}
Upvotes: 2