Ng-repeat Not Working With Table But Works With List
I have the following code: Code on Plnkr I am trying to use ng-repeat within a table. But that doesnt work. Whereas the same code works for list Here is a snippet of the
Solution 1:
Tables are defined with the tag.
Tables are divided into table rows with the tag.
Table rows are divided into table data with the tag.
A table row can also be divided into table headings with the tag.
So the root cause is that you miss a <td>
or <th>
element inside your <tr>
element
<trng-repeat="item in sampleArray"><td>{{item}}</td></tr>
Solution 2:
As you building a table with the ng-repeat
, you should specify the content of each row cells, with the td
tag like this:
<table><trng-repeat="item in sampleArray"><td>{{$index}}</td><td>{{item}}</td></tr></table>
Solution 3:
Yeah, checked on the plunker,
You need to remember to put in the <td>
into the <tr>
. <td>
is display element and <tr>
is structural.
<trng-repeat="item in sampleArray"><td>{{item}}</td></tr>
Post a Comment for "Ng-repeat Not Working With Table But Works With List