扫码关注官方订阅号
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>',
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
控制器中增加变量就行:
table2 中修改为:
就可以实现~
ng-repeat 一般不建议 用 动态的,这样 很影响性能。
如果坚持这样写,可以写成:
值也能过来: