Demo:http://codepen.io/mafeifan/pe... ng-repeat 嵌套,先遍历tr再遍历td。使用原生html能输出正确内容。但当把td写为directive就不显示了。不知道什么原因,求指教。
控制器中增加变量就行: vm.list = [1,2]; table2 中修改为: <form-cell ng-repeat='cell in vm.list'>data</form-cell> 就可以实现~ ng-repeat 一般不建议 用 动态的,这样 很影响性能。 如果坚持这样写,可以写成: <tr ng-repeat="grid in vm.repeatCount() track by $index"> <td ng-repeat='cell in vm.getDataByIndex($index)'> <form-cell></form-cell> </td> </tr> 值也能过来: template: '<span>data</span>',
控制器中增加变量就行:
table2 中修改为:
就可以实现~
ng-repeat 一般不建议 用 动态的,这样 很影响性能。
如果坚持这样写,可以写成:
值也能过来: