Demo: http://codepen.io/mafeifan/pe...
ng-repeat is nested, traversing tr first and then td.
Using native html can output correct content.
But when td is written as directive, it will not be displayed. I don't know why, please give me some advice.
高洛峰2017-05-15 17:07:53
Just add variables in the controller:
vm.list = [1,2];
table2 is modified to:
<form-cell ng-repeat='cell in vm.list'>data</form-cell>
It can be achieved~
ng-repeat is generally not recommended to be dynamic, as this will affect performance.
If you insist on writing like this, you can write it as:
<tr ng-repeat="grid in vm.repeatCount() track by $index">
<td ng-repeat='cell in vm.getDataByIndex($index)'>
<form-cell></form-cell>
</td>
</tr>
The value can also come:
template: '<span>data</span>',