0

In my cshtml view I have the following table:

<table>
    <thead>
    <tr><th>Test</th></tr>
</thead>
<tbody>
    <tr ng-repeat="label in labels">
        <td>{{label.id}}</td>
    </tr>
</tbody>

And when I view the page and inspect the table element in my browser only the table headings are displayed and no rows. Applying ng-repeat seems to comment out the rows automatically as below:

<table class="ng-scope">
  <thead>
      <tr><th>Test</th></tr>
  </thead>
  <tbody>
      <!-- ngRepeat: label in labels -->
  </tbody>
</table>

when I remove ng-repeat="label in labels" and apply a static value in the row cell the row is not commented and displays just fine.

Does anyone knows what could be causing this behaviour?

2
  • Can you post the javascript? Commented Jan 30, 2014 at 2:00
  • 1
    Looks like labels is empty or undefined. Commented Jan 30, 2014 at 2:04

1 Answer 1

2

Upon compilation angular automatically adds the ngRepeat comment to the HTML, in order to indicate that below this comment, the repeated elements will be displayed.

The reason why your tbody doesn't contain any rows, is because your $scope.labels object is empty.

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

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.