0

JSFiddle here

<tr ng-repeat="item in schedule.days[0].entries" scope="row">
          <th>{{item.name}}</td>
          <td ng-repeat="x in schedule.days.entries">{{x.value}}</td>
        </tr>

I am trying to create a dynamic table in angularjs. I got to a point where I am able to display the name and table row but in table data I am not able to bind the value object property. Can someone please guide me what I am doing wrong on my ng repeat. I have been stuck on this for two days now some guidence would be really appreciated. Thank you

1
  • It's better to share your code here, instead of just pasting a fiddle link. Commented Dec 7, 2018 at 15:15

1 Answer 1

0

You're trying to access schedule.days.entries, but days is an array, not an object. You're missing the index, e.g.

<td ng-repeat="x in schedule.days[0].entries">{{x.value}}</td>

https://jsfiddle.net/0xsv2aq3/

Edit:

I was just showing how to access the values. If you want to take the values for the same name in different days and show it in the table, you can do something like this.

https://jsfiddle.net/bray3gmd/

Sign up to request clarification or add additional context in comments.

3 Comments

so why does it not match the table data with table correctly though you see it does not fit table properly
You are not iterating over the whole array, you are just repeating the first item in all tds.
so If i need to have the name stay constant isnt this the way to do it so i have have my name distinct

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.