angular.js - ng-repeat traversal directive does not take effect
PHPz
PHPz 2017-05-15 17:05:53
0
1
654

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.

PHPz
PHPz

学习是最好的投资!

reply all(1)
小葫芦

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>',
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template