Demo:http://codepen.io/mafeifan/pe...
ng-repeat 嵌套,先遍历tr再遍历td。使用原生html能输出正确内容。但当把td写为directive就不显示了。不知道什么原因,求指教。
学习是最好的投资!
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>',
Just add variables in the controller:
table2 is modified to:
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:
The value can also come: