0

I have two loops in my template file.i am trying to bind second value using first loop value.But i am getting error.

<tr *ngFor="let splitdata of mf.data">
  <td *ngFor="let slitup of searchFieldsslitup">
    {{splitdata.slitup.headName}}
  </td>
</tr>
1
  • how does the mf.data look like and what do you want to bind Commented Feb 12, 2019 at 16:18

2 Answers 2

1

Use the bracket notation to access the properties by their name:

<tr *ngFor="let splitdata of mf.data">
  <td *ngFor="let slitup of searchFieldsslitup">
    {{ splitdata[slitup.headName] }}
  </td>
</tr>
Sign up to request clarification or add additional context in comments.

1 Comment

{{ splitdata[slitup.headName] }} works for me...thanks
0

you could also try this:

<tr *ngFor="let splitdata of mf.data">
  <td *ngFor="let slitup of splitdata">
    {{slitup.headName }}
  </td>
</tr>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.